Commit 2112ac9f authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix retroactive wizard: never set paid_amount for non-paid status

The elseif branch accepted form's paid_amount even when status was
'overdue', causing paid_amount to equal total_amount without a payment
record. This made fine calculator see unpaid=0 and skip the year.

Now only status='paid' sets paid_amount; all other statuses get 0.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 2da473e7
......@@ -660,12 +660,10 @@ final class RetroactiveMembershipService
// total_amount = base - discount (dev fee is separate, added at invoice level)
$totalAmount = bcsub($baseAmount, $discountAmount, 2);
// For paid status: paid_amount = total (dev fee is invoice-level, not per-row paid)
// paid_amount only set when status is actually paid
$paidAmount = '0.00';
if ($status === 'paid') {
$paidAmount = $totalAmount;
} elseif (isset($sub['paid_amount']) && bccomp((string) $sub['paid_amount'], '0', 2) > 0) {
$paidAmount = (string) $sub['paid_amount'];
}
$paymentId = null;
......
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