fix enrollment and email send to parent
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Failing after 1m20s

This commit is contained in:
root
2026-08-27 12:39:08 -04:00
parent 7b86cf5218
commit 0ae9993d82
19 changed files with 37831 additions and 1313 deletions
+28 -11
View File
@@ -2010,8 +2010,14 @@ class ParentController extends BaseController
private function enrollmentTuitionDue(array $students): float
{
$tuitionStudents = [];
$existingTuitionStudentCount = 0;
foreach ($students as $student) {
if ($this->countsTowardCurrentYearTuition($student)) {
$existingTuitionStudentCount++;
continue;
}
$evaluation = is_array($student['transition_evaluation'] ?? null) ? $student['transition_evaluation'] : [];
if (
($evaluation['can_enroll'] ?? false) !== true
@@ -2034,9 +2040,29 @@ class ParentController extends BaseController
return 0.0;
}
if ($existingTuitionStudentCount > 0) {
$additionalStudentFee = (float) ($this->configModel->getConfig('second_student_fee') ?? 280);
return round(count($tuitionStudents) * $additionalStudentFee, 2);
}
return (new FeeCalculationService())->calculateEnrollmentTuition($tuitionStudents);
}
private function countsTowardCurrentYearTuition(array $student): bool
{
$status = strtolower(trim((string) ($student['enrollment_status'] ?? '')));
if (in_array($status, ['withdrawn', 'withdraw under review', 'refund pending', 'denied', 'not enrolled'], true)) {
return false;
}
if (in_array($status, ['admission under review', 'review & decision', 'payment pending', 'enrolled', 'waitlist'], true)) {
return true;
}
return strtolower(trim((string) ($student['admission_status'] ?? ''))) === 'accepted';
}
private function enrollmentFeeSchedule(string $selectedYear): array
{
$schoolYearConfig = $this->schoolYearConfig($selectedYear);
@@ -2673,7 +2699,6 @@ class ParentController extends BaseController
$this->db->transStart();
$studentAdded = false;
$registeredStudentIds = [];
// Gather all POST data for last year flags
$rawPost = $this->request->getPost();
@@ -2700,9 +2725,6 @@ class ParentController extends BaseController
if ($result) {
$studentAdded = true;
if (is_numeric($result) && (int) $result > 0) {
$registeredStudentIds[] = (int) $result;
}
}
}
}
@@ -2724,13 +2746,8 @@ class ParentController extends BaseController
}
if ($studentAdded) {
$enrollmentQuery = ['start' => 2];
if ($registeredStudentIds !== []) {
$enrollmentQuery['students'] = implode(',', array_values(array_unique($registeredStudentIds)));
}
return redirect()->to(base_url('/parent/enroll_classes?' . http_build_query($enrollmentQuery)))
->with('success', 'Registration successful! Continue enrollment by confirming your home address and phone number.');
return redirect()->to(base_url('/parent/enroll_classes?' . http_build_query(['start' => 1])))
->with('success', 'Registration successful! Continue enrollment by selecting all students you want to enroll.');
}
return redirect()->to(base_url('/parent/child_register'))->with('success', 'Registration successful!');