fix enrollment for the new school-year
Tests / PHPUnit (push) Successful in 1m26s

This commit is contained in:
root
2026-08-07 23:43:31 -04:00
parent b6f3b14e7b
commit 1ef2800f12
66 changed files with 8997 additions and 498 deletions
+10
View File
@@ -92,6 +92,13 @@ class EventController extends ResourceController
return $this->eventChargesHasCreatedBy;
}
private function assertSchoolYearNameWritable(string $schoolYear): void
{
service('schoolYearWriteGuard')->assertWritable(
service('schoolYearContext')->forYearName($schoolYear)
);
}
private function currentSchoolYearName(): string
{
try {
@@ -939,6 +946,7 @@ class EventController extends ResourceController
if (!$charge) {
return redirect()->to($returnTo)->with('error', 'Charge not found.');
}
$this->assertSchoolYearNameWritable((string)($charge['school_year'] ?? ''));
$paymentId = (int)($charge['event_payment_id'] ?? 0);
if ($paymentId > 0) {
@@ -989,6 +997,7 @@ class EventController extends ResourceController
if (!$charge) {
return redirect()->to($returnTo)->with('error', 'Charge not found.');
}
$this->assertSchoolYearNameWritable((string)($charge['school_year'] ?? ''));
$signed = $this->request->getPost('waiver_signed') === '1';
@@ -1070,6 +1079,7 @@ class EventController extends ResourceController
if (!$charge) {
return null;
}
$this->assertSchoolYearNameWritable((string)($charge['school_year'] ?? ''));
$event = $this->eventModel->find($charge['event_id']);
$eventAmount = max(0.0, (float)($event['amount'] ?? 0));