完善供应商合作合同与授权书签署自动填充
This commit is contained in:
parent
f74854d542
commit
8b31e5a138
@ -41,7 +41,7 @@ class CourierAgreementSignatures extends Controller
|
||||
$request->validate(['partner_type' => ['required', 'in:courier,supplier']]);
|
||||
if ($request->input('partner_type') === 'supplier') {
|
||||
$request->validate(['supplier_id' => ['required', 'integer', 'min:1'],
|
||||
'document_type' => ['required', 'in:account-proof,account-change,entity-change']]);
|
||||
'document_type' => ['required', 'in:account-proof,account-change,entity-change,cooperation-contract,authorization']]);
|
||||
$supplier = app(\Modules\EcommerceFinance\Repositories\SupplierManagementMirrorRepository::class)
|
||||
->signingSupplier((int) $request->input('supplier_id'));
|
||||
if (! $supplier) throw ValidationException::withMessages(['supplier_id' => '供应商资料暂不可用,请重新选择供应商。']);
|
||||
|
||||
@ -2763,7 +2763,7 @@
|
||||
secondaryOperatorInput.value = '';
|
||||
root.querySelector('[data-request-error]').textContent = '';
|
||||
supplierIdInput.value = '';
|
||||
['former_company_name'].forEach(function (name) {
|
||||
['former_company_name', 'cooperation_party_b_name', 'principal_name'].forEach(function (name) {
|
||||
var input = form.querySelector('[name="' + name + '"]');
|
||||
if (input) input.value = '';
|
||||
});
|
||||
@ -2876,8 +2876,10 @@
|
||||
delete esignAccountInput.dataset.autoFilled;
|
||||
accountOrganizationInput.value = supplier ? supplier.company : '';
|
||||
operatorNameInput.value = supplier ? supplier.operator : '';
|
||||
var formerCompany = form.querySelector('[name="former_company_name"]');
|
||||
if (formerCompany) formerCompany.value = supplier ? supplier.company : '';
|
||||
['former_company_name', 'cooperation_party_b_name', 'principal_name'].forEach(function (name) {
|
||||
var input = form.querySelector('[name="' + name + '"]');
|
||||
if (input) input.value = supplier ? supplier.company : '';
|
||||
});
|
||||
}
|
||||
supplierControl.textContent = supplier
|
||||
? supplier.value + ' · ' + supplier.code + (supplier.company ? ' · ' + supplier.company : '') + (supplier.account ? '' : ';未维护易签宝账号,请手工填写并核对。')
|
||||
|
||||
@ -128,6 +128,26 @@ class CourierAgreementSignatureWorkflowTest extends FeatureTestCase
|
||||
Http::assertNothingSent();
|
||||
}
|
||||
|
||||
public function test_supplier_cooperation_contract_keeps_both_signing_parties(): void
|
||||
{
|
||||
$this->fakeEsign();
|
||||
$repository = Mockery::mock(SupplierManagementMirrorRepository::class);
|
||||
$repository->shouldReceive('signingSupplier')->with(7)->once()->andReturn((object) [
|
||||
'Id' => 7, 'scmname' => '测试供应商', 'accountbankno' => '13900139000',
|
||||
]);
|
||||
$this->app->instance(SupplierManagementMirrorRepository::class, $repository);
|
||||
$payload = $this->cooperationContractPayload('supplier-cooperation');
|
||||
$payload['partner_type'] = 'supplier';
|
||||
$payload['supplier_id'] = 7;
|
||||
unset($payload['esign_account']);
|
||||
$this->loginAs()->post(route('business.courier-agreement-signatures.store'), $payload)->assertRedirect();
|
||||
$signature = CourierAgreementSignature::query()->firstOrFail();
|
||||
$this->assertSame('测试供应商', $signature->courier_name);
|
||||
$this->assertSame('13900139000', $signature->operator_account);
|
||||
$this->assertSame('18052733960', $signature->payload['secondary_esign_account']);
|
||||
$this->assertSame(CourierAgreementSignature::STATUS_SIGNING, $signature->status);
|
||||
}
|
||||
|
||||
public function test_unknown_partner_type_is_rejected_before_sending(): void
|
||||
{
|
||||
Http::preventStrayRequests();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user