fix:updateManual()도 Query Builder로 전환 (numeric dirty 감지 문제)

수동 거래 수정 시 Eloquent가 deposit/withdraw/balance를
dirty로 오감지 (DB "515900.00" vs validation 515900 비교).
DB::table()로 변경하여 지정 필드만 정확히 업데이트.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-10 16:48:28 +09:00
parent 1cab267ec6
commit 587c21fa11

View File

@@ -1253,23 +1253,28 @@ public function updateManual(Request $request, int $id): JsonResponse
$transTime = $validated['trans_time'] ?? '000000';
$transDt = $validated['trans_date'] . $transTime;
$transaction->update([
'bank_account_num' => $validated['bank_account_num'],
'bank_code' => $validated['bank_code'] ?? '',
'bank_name' => $validated['bank_name'] ?? '',
'trans_date' => $validated['trans_date'],
'trans_time' => $transTime,
'trans_dt' => $transDt,
'deposit' => $validated['deposit'],
'withdraw' => $validated['withdraw'],
'balance' => $validated['balance'] ?? 0,
'summary' => $validated['summary'] ?? '',
'cast' => $validated['cast'] ?? '',
'memo' => $validated['memo'] ?? '',
'trans_office' => $validated['trans_office'] ?? '',
'account_code' => $validated['account_code'] ?? null,
'account_name' => $validated['account_name'] ?? null,
]);
// Query Builder 사용: Eloquent의 numeric dirty 감지 문제 방지
// (DB의 "515900.00" 문자열 vs validation 후 515900 정수 비교 시 dirty 오감지)
DB::table('barobill_bank_transactions')
->where('id', $transaction->id)
->update([
'bank_account_num' => $validated['bank_account_num'],
'bank_code' => $validated['bank_code'] ?? '',
'bank_name' => $validated['bank_name'] ?? '',
'trans_date' => $validated['trans_date'],
'trans_time' => $transTime,
'trans_dt' => $transDt,
'deposit' => $validated['deposit'],
'withdraw' => $validated['withdraw'],
'balance' => $validated['balance'] ?? 0,
'summary' => $validated['summary'] ?? '',
'cast' => $validated['cast'] ?? '',
'memo' => $validated['memo'] ?? '',
'trans_office' => $validated['trans_office'] ?? '',
'account_code' => $validated['account_code'] ?? null,
'account_name' => $validated['account_name'] ?? null,
'updated_at' => now(),
]);
return response()->json([
'success' => true,