fix reset password
This commit is contained in:
@@ -187,7 +187,7 @@ final class EnrollmentRegistrationEmailService
|
||||
);
|
||||
$studentRows[] = $this->studentRow($student, $evaluation, $opens, $deadline, $schoolYear);
|
||||
$studentIds[] = $studentId;
|
||||
$hasReEnrollmentEligibleStudent = $hasReEnrollmentEligibleStudent || (bool) ($evaluation['can_enroll'] ?? false);
|
||||
$hasReEnrollmentEligibleStudent = $hasReEnrollmentEligibleStudent || $this->canCompleteParentReEnrollment($evaluation);
|
||||
}
|
||||
|
||||
$financial = $this->financialSection((int) $family['parent_user_id'], $schoolYear, $previousYear);
|
||||
@@ -215,7 +215,7 @@ final class EnrollmentRegistrationEmailService
|
||||
|
||||
private function canCompleteParentReEnrollment(array $evaluation): bool
|
||||
{
|
||||
return (bool) ($evaluation['can_enroll'] ?? false);
|
||||
return (bool) ($evaluation['parent_enrollment_allowed'] ?? $evaluation['can_enroll'] ?? false);
|
||||
}
|
||||
|
||||
private function registrationStepsSection(string $opens, string $deadline, bool $include): string
|
||||
@@ -306,7 +306,7 @@ final class EnrollmentRegistrationEmailService
|
||||
return (string) $evaluation['primary_parent_message'];
|
||||
}
|
||||
|
||||
if (($evaluation['blockers'] ?? []) !== []) {
|
||||
if (($evaluation['blockers'] ?? []) !== [] && ! $this->hasOnlyNonBlockingEmailBlockers($evaluation)) {
|
||||
return implode(' ', array_values(array_unique(array_filter(array_map(
|
||||
static fn ($blocker): string => trim((string) $blocker),
|
||||
$evaluation['blockers']
|
||||
@@ -314,6 +314,7 @@ final class EnrollmentRegistrationEmailService
|
||||
}
|
||||
|
||||
return match ((string) ($evaluation['deliberation_decision'] ?? '')) {
|
||||
DeliberationDecision::PASSED => $name . ' has successfully passed ' . $this->currentGradeText($evaluation) . '.',
|
||||
DeliberationDecision::REPEAT_CLASS => 'The deliberation decision for ' . $name . ' is to repeat the current grade. After re-enrollment is completed, the student will remain in the same grade.',
|
||||
DeliberationDecision::MAKE_UP_EXAM => 'The final academic decision for ' . $name . ' is currently pending the result of a make-up exam. This exam is scheduled for ' . $this->makeupExamDateText($schoolYear) . ' from 9:30 AM to 11:00 AM at ISGL.'
|
||||
. "\n" . 'The exam result will determine whether the student advances to the next grade or repeats the current class. Failure to attend the make-up exam will automatically result in the student repeating the class, as no further retake opportunities will be available.'
|
||||
@@ -355,7 +356,13 @@ final class EnrollmentRegistrationEmailService
|
||||
$previousYear ?? '',
|
||||
$schoolYearName
|
||||
);
|
||||
$fallbackTotal = (float) ($schoolYear['registration_fee'] ?? 0)
|
||||
+ (float) ($schoolYear['tuition_due_at_registration'] ?? 0)
|
||||
+ (float) ($schoolYear['mandatory_fees'] ?? 0);
|
||||
$total = (float) ($summary['total_enrollment_due'] ?? $summary['amount_due'] ?? 0);
|
||||
if ($total <= 0.0 && $fallbackTotal > 0.0) {
|
||||
$total = $fallbackTotal;
|
||||
}
|
||||
if ($total <= 0.0) {
|
||||
return '';
|
||||
}
|
||||
@@ -521,7 +528,7 @@ final class EnrollmentRegistrationEmailService
|
||||
|
||||
private function registrationStatus(array $evaluation): string
|
||||
{
|
||||
if (($evaluation['can_enroll'] ?? false) === true) {
|
||||
if ($this->canCompleteParentReEnrollment($evaluation)) {
|
||||
return ($evaluation['deliberation_decision'] ?? '') === DeliberationDecision::MAKE_UP_EXAM
|
||||
? 'Eligible with pending placement'
|
||||
: 'Eligible';
|
||||
@@ -543,6 +550,18 @@ final class EnrollmentRegistrationEmailService
|
||||
return 'Not Eligible';
|
||||
}
|
||||
|
||||
if (($evaluation['blockers'] ?? []) !== [] && ! $this->hasOnlyNonBlockingEmailBlockers($evaluation)) {
|
||||
return 'Not Eligible';
|
||||
}
|
||||
|
||||
if (($evaluation['deliberation_decision'] ?? '') === DeliberationDecision::PASSED) {
|
||||
return 'Eligible';
|
||||
}
|
||||
|
||||
if (($evaluation['deliberation_decision'] ?? '') === DeliberationDecision::MAKE_UP_EXAM) {
|
||||
return 'Eligible with pending placement';
|
||||
}
|
||||
|
||||
if (($evaluation['blockers'] ?? []) !== []) {
|
||||
return 'Not Eligible';
|
||||
}
|
||||
@@ -566,6 +585,30 @@ final class EnrollmentRegistrationEmailService
|
||||
return array_values(array_diff($codes, $ignoredCodes)) !== [];
|
||||
}
|
||||
|
||||
private function hasOnlyNonBlockingEmailBlockers(array $evaluation): bool
|
||||
{
|
||||
$blockers = array_values(array_filter(array_map(
|
||||
static fn ($blocker): string => strtolower(trim((string) $blocker)),
|
||||
$evaluation['blockers'] ?? []
|
||||
)));
|
||||
if ($blockers === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($blockers as $blocker) {
|
||||
if (
|
||||
str_contains($blocker, 'registration for the new school year has not opened yet')
|
||||
|| str_contains($blocker, 'passed the highest available grade')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function studentIssueCode(array $evaluation): string
|
||||
{
|
||||
if (! empty($evaluation['adult_student'])) {
|
||||
@@ -617,12 +660,20 @@ final class EnrollmentRegistrationEmailService
|
||||
|
||||
private function requiredAction(array $evaluation, string $deadline, string $name = 'The student'): string
|
||||
{
|
||||
if (($evaluation['can_enroll'] ?? false) === true) {
|
||||
if ($this->canCompleteParentReEnrollment($evaluation)) {
|
||||
return ($evaluation['deliberation_decision'] ?? '') === DeliberationDecision::MAKE_UP_EXAM
|
||||
? ''
|
||||
: 'Complete re-enrollment before ' . $deadline . '.';
|
||||
}
|
||||
|
||||
if (($evaluation['deliberation_decision'] ?? '') === DeliberationDecision::MAKE_UP_EXAM && ($evaluation['blockers'] ?? []) === []) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (($evaluation['deliberation_decision'] ?? '') === DeliberationDecision::PASSED && $this->hasOnlyNonBlockingEmailBlockers($evaluation)) {
|
||||
return 'Complete re-enrollment before ' . $deadline . '.';
|
||||
}
|
||||
|
||||
if (! empty($evaluation['primary_parent_message'])) {
|
||||
return (string) $evaluation['primary_parent_message'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user