fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
@@ -18,7 +18,8 @@ class InvoiceGenerationService
public function __construct(
private InvoiceConfigService $config,
private InvoiceTuitionService $tuitionService
) {}
) {
}
public function generateInvoice(int $parentId, ?string $schoolYear = null): array
{
@@ -63,13 +64,11 @@ class InvoiceGenerationService
$registeredKids = array_values(array_filter($registeredKids, function ($student) use ($schoolYear) {
$sid = (int) ($student['student_id'] ?? 0);
return $sid > 0 && StudentClass::hasNonEventAssignment($sid, $schoolYear);
}));
$withdrawnKids = array_values(array_filter($withdrawnKids, function ($student) use ($schoolYear) {
$sid = (int) ($student['student_id'] ?? 0);
return $sid > 0 && StudentClass::hasNonEventAssignment($sid, $schoolYear);
}));
@@ -84,7 +83,7 @@ class InvoiceGenerationService
$this->recalculateAndUpdateDiscount($parentId, $schoolYear, $tuitionFee, $enrollments);
$refundPaid = (new Refund)->getTotalApprovedRefundByParentIdAndSchoolYear($parentId, $schoolYear);
$refundPaid = (new Refund())->getTotalApprovedRefundByParentIdAndSchoolYear($parentId, $schoolYear);
$totalPaid = Payment::getTotalPaidByParentId($parentId, $schoolYear);
$totalAmount = max(0.0, (float) $tuitionFee) + (float) $eventChargeTotal;
@@ -94,9 +93,9 @@ class InvoiceGenerationService
$updatedIds = [];
$insertId = null;
if (! empty($existingInvoices)) {
if (!empty($existingInvoices)) {
foreach ($existingInvoices as $invoice) {
if (! isset($invoice['id'])) {
if (!isset($invoice['id'])) {
continue;
}
@@ -128,14 +127,14 @@ class InvoiceGenerationService
} else {
$schoolId = User::getSchoolIdByUserId($parentId);
$invoiceNumber = $schoolId
? ('INV-'.$schoolId.'-'.uniqid())
? ('INV-' . $schoolId . '-' . uniqid())
: uniqid('INV-');
$issueUtc = (new DateTime('now', new DateTimeZone('UTC')))->format('Y-m-d H:i:s');
$dueUtc = null;
$dueDate = $this->config->getDueDate();
if (! empty($dueDate)) {
$dueLocal = new DateTime($dueDate.' 19:59:59', new DateTimeZone($this->config->getTimezone()));
if (!empty($dueDate)) {
$dueLocal = new DateTime($dueDate . ' 19:59:59', new DateTimeZone($this->config->getTimezone()));
$dueLocal->setTimezone(new DateTimeZone('UTC'));
$dueUtc = $dueLocal->format('Y-m-d H:i:s');
}
@@ -181,7 +180,7 @@ class InvoiceGenerationService
}
foreach ($invoices as $invoice) {
if (! isset($invoice['id'])) {
if (!isset($invoice['id'])) {
continue;
}
@@ -194,7 +193,7 @@ class InvoiceGenerationService
->where('i.school_year', $schoolYear)
->first();
if (! $discountUsage) {
if (!$discountUsage) {
continue;
}