Commit 26838f17 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(waiver): handle empty date_of_birth strings in individual fee insert

MySQL rejects empty strings for DATE columns. The approve form sends
empty strings for persons without a DOB (spouses, temporary members).
Convert empty strings to null for date_of_birth, relationship, status,
and notes fields before INSERT.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 9044313e
......@@ -491,6 +491,8 @@ final class WaiverProcessor
$feeAmount = number_format((float) $feeRate, 2, '.', '');
}
$dob = trim((string) ($fee['date_of_birth'] ?? ''));
$db->insert('waiver_individual_fees', [
'waiver_request_id' => $waiverId,
'person_type' => $fee['person_type'],
......@@ -502,10 +504,10 @@ final class WaiverProcessor
'fee_amount' => $feeAmount,
'age_years' => $fee['age_years'] ?? null,
'age_category' => $fee['age_category_code'] ?? $fee['age_category'] ?? null,
'date_of_birth' => $fee['date_of_birth'] ?? null,
'relationship' => $fee['relationship'] ?? null,
'status' => $fee['status'] ?? null,
'notes' => $fee['notes'] ?? null,
'date_of_birth' => $dob !== '' ? $dob : null,
'relationship' => ($fee['relationship'] ?? '') !== '' ? $fee['relationship'] : null,
'status' => ($fee['status'] ?? '') !== '' ? $fee['status'] : null,
'notes' => ($fee['notes'] ?? '') !== '' ? $fee['notes'] : null,
]);
if ($fee['person_type'] === 'spouse') $spouseTotal = bcadd($spouseTotal, $feeAmount, 2);
......
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