fix: 修复内部转账审计字段超长 (#1227)
修复内部转账审计类型超过 `fin_ledger_edit_events.entity_type` 20 字符限制导致的事务回滚和 Server Error。 将类型缩短为 `internal_xfer_create` / `internal_xfer_delete`,并补充审计落库测试。 验证:内部转账创建、删除测试 2 项通过,38 个断言。
This commit is contained in:
parent
ceac04e1e0
commit
957504ac1e
@ -112,7 +112,7 @@ class FinanceLedgerInternalTransferEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($created > 0) {
|
if ($created > 0) {
|
||||||
$this->audit('internal_transfer_create', $approvalNo, [
|
$this->audit('internal_xfer_create', $approvalNo, [
|
||||||
'txn_date' => $date,
|
'txn_date' => $date,
|
||||||
'from_account_short' => $from,
|
'from_account_short' => $from,
|
||||||
'to_account_short' => $to,
|
'to_account_short' => $to,
|
||||||
@ -162,7 +162,7 @@ class FinanceLedgerInternalTransferEditor
|
|||||||
->where('source', FinanceLedgerTransactionWriter::INTERNAL_TRANSFER_SOURCE)
|
->where('source', FinanceLedgerTransactionWriter::INTERNAL_TRANSFER_SOURCE)
|
||||||
->where('approval_no', $approvalNo)
|
->where('approval_no', $approvalNo)
|
||||||
->delete();
|
->delete();
|
||||||
$this->audit('internal_transfer_delete', $approvalNo, [
|
$this->audit('internal_xfer_delete', $approvalNo, [
|
||||||
'rows' => $rows->map(static fn (object $item): array => [
|
'rows' => $rows->map(static fn (object $item): array => [
|
||||||
'account_short' => (string) $item->account_short,
|
'account_short' => (string) $item->account_short,
|
||||||
'income' => round((float) $item->income, 2),
|
'income' => round((float) $item->income, 2),
|
||||||
|
|||||||
@ -435,6 +435,10 @@ class FinanceLedgerManualTransactionTest extends FeatureTestCase
|
|||||||
'account_short' => '手工账户乙',
|
'account_short' => '手工账户乙',
|
||||||
'current_balance' => 30,
|
'current_balance' => 30,
|
||||||
], 'business_mirror');
|
], 'business_mirror');
|
||||||
|
$this->assertDatabaseHas('fin_ledger_edit_events', [
|
||||||
|
'entity_type' => 'internal_xfer_create',
|
||||||
|
'user_name' => 'Test User',
|
||||||
|
], 'business_mirror');
|
||||||
|
|
||||||
$this->postJson($this->internalTransferUrl(), $payload)
|
$this->postJson($this->internalTransferUrl(), $payload)
|
||||||
->assertOk()
|
->assertOk()
|
||||||
@ -469,6 +473,10 @@ class FinanceLedgerManualTransactionTest extends FeatureTestCase
|
|||||||
'account_short' => '手工账户乙',
|
'account_short' => '手工账户乙',
|
||||||
'current_balance' => 0,
|
'current_balance' => 0,
|
||||||
], 'business_mirror');
|
], 'business_mirror');
|
||||||
|
$this->assertDatabaseHas('fin_ledger_edit_events', [
|
||||||
|
'entity_type' => 'internal_xfer_delete',
|
||||||
|
'user_name' => 'Test User',
|
||||||
|
], 'business_mirror');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_internal_transfer_page_and_same_account_validation(): void
|
public function test_internal_transfer_page_and_same_account_validation(): void
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user