fix enrollment, invoice, payment and financila aid
This commit is contained in:
@@ -525,16 +525,15 @@ class PaymentController extends ResourceController
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 2) Payment check: recompute current balance from payments (authoritative)
|
||||
$total = (float) ($invoice['total_amount'] ?? 0);
|
||||
$currentBal = $this->getCurrentInvoiceBalance($invoiceId); // <-- uses the safe helper
|
||||
if (!($total > 0 && $currentBal < $total)) {
|
||||
log_message('info', 'No payment yet (or still full balance). Skipping enrollment update. Invoice #{id}', ['id' => $invoiceId]);
|
||||
// 2) Payment check: enrollment transitions only after the invoice is fully paid
|
||||
$currentBal = $this->getCurrentInvoiceBalance($invoiceId);
|
||||
if ($currentBal > 0.00001) {
|
||||
log_message('info', 'Invoice not fully paid. Skipping enrollment update. Invoice #{id}', ['id' => $invoiceId]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$parentId = (int) ($invoice['parent_id'] ?? 0);
|
||||
$schoolYear = (string) $this->schoolYear;
|
||||
$schoolYear = (string) ($invoice['school_year'] ?? $this->schoolYear);
|
||||
$semester = isset($this->semester) && $this->semester !== '' ? (string)$this->semester : null;
|
||||
|
||||
if ($parentId <= 0 || $schoolYear === '') {
|
||||
|
||||
Reference in New Issue
Block a user