Commit b4200e99 authored by DevPilot's avatar DevPilot

fix(accounting): voucher save crashed when payment method is not a cheque

The cheque fields stay in the voucher form for every payment method, so
check_date posts as '' when paying cash or by transfer. That went
straight into a DATE column and MySQL rejected the row with
"Incorrect date value: ''", so no non-cheque voucher could be saved at
all. Send NULL instead; VoucherService already accepted null.

Found by driving the voucher screen end-to-end while building the
step-by-step accounting tutorial.
parent e0581a11
...@@ -111,7 +111,9 @@ class VoucherController extends Controller ...@@ -111,7 +111,9 @@ class VoucherController extends Controller
'member_id' => $request->post('member_id'), 'member_id' => $request->post('member_id'),
'check_number' => $request->post('check_number'), 'check_number' => $request->post('check_number'),
'check_bank' => $request->post('check_bank'), 'check_bank' => $request->post('check_bank'),
'check_date' => $request->post('check_date'), // The cheque fields stay in the form even when paying cash/bank, so they
// arrive as '' — and '' is not a DATE. Send NULL or MySQL rejects the row.
'check_date' => trim((string) $request->post('check_date', '')) ?: null,
'reference' => $request->post('reference'), 'reference' => $request->post('reference'),
'description_ar' => $request->post('description_ar'), 'description_ar' => $request->post('description_ar'),
'notes' => $request->post('notes'), 'notes' => $request->post('notes'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment