fix enrollment, invoice, payment and financila aid
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Failing after 1m19s

This commit is contained in:
root
2026-08-24 21:20:58 -04:00
parent 576da3bd78
commit 608aca79b8
30 changed files with 3327 additions and 774 deletions
+14 -3
View File
@@ -753,8 +753,9 @@ final class SchoolYearClosingService
];
if ($this->db->fieldExists('description', 'invoices')) {
$label = $amount > 0 ? 'Balance carried over' : 'Credit carried over';
$payload['description'] = "{$label} from previous school year {$sourceYear}.";
$payload['description'] = $amount >= 0
? "Carry over balance from last year {$sourceYear}"
: "Credit carry over from last year {$sourceYear}";
}
$invoiceModel = new InvoiceModel();
@@ -763,7 +764,17 @@ final class SchoolYearClosingService
throw new RuntimeException('Unable to create carry-forward invoice: ' . json_encode($invoiceModel->errors()));
}
return (int) $invoiceId;
$invoiceId = (int) $invoiceId;
$description = (string) ($payload['description'] ?? "Carry over balance from last year {$sourceYear}");
try {
$ledgerService = new \App\Libraries\InvoiceLedgerService();
$ledgerService->issueCarryForwardInvoiceLine($invoiceId, $amount, $description);
$ledgerService->recalculateInvoice($invoiceId);
} catch (\Throwable $e) {
log_message('error', 'Carry-forward invoice line issuance failed for invoice ' . $invoiceId . ': ' . $e->getMessage());
}
return $invoiceId;
}
private function carryForwardInvoiceNumber(int $itemId, int $parentId, string $sourceYear, string $targetYear): string