fix all issues before deploy
This commit is contained in:
@@ -484,12 +484,13 @@ class EnrollmentAdminController extends BaseController
|
||||
if (is_numeric($assignedTo) && (int) $assignedTo > 0) {
|
||||
$builder->where('ef.assigned_to', (int) $assignedTo);
|
||||
}
|
||||
$builder->where('ef.flag_type !=', 'CLASS_CAPACITY_EXCEPTION_REQUIRED');
|
||||
$ignoredFlagTypes = ['CLASS_CAPACITY_EXCEPTION_REQUIRED', 'CLASS_REASSIGNMENT_REQUIRED'];
|
||||
$builder->whereNotIn('ef.flag_type', $ignoredFlagTypes);
|
||||
|
||||
$rows = $builder->get()->getResultArray();
|
||||
$rows = array_values(array_filter(
|
||||
$rows,
|
||||
static fn (array $row): bool => (string) ($row['flag_type'] ?? '') !== 'CLASS_CAPACITY_EXCEPTION_REQUIRED'
|
||||
static fn (array $row): bool => ! in_array((string) ($row['flag_type'] ?? ''), $ignoredFlagTypes, true)
|
||||
));
|
||||
foreach ($rows as &$row) {
|
||||
$row['student_name'] = trim((string) ($row['firstname'] ?? '') . ' ' . (string) ($row['lastname'] ?? '')) ?: 'Student #' . (int) ($row['student_id'] ?? 0);
|
||||
@@ -663,7 +664,6 @@ class EnrollmentAdminController extends BaseController
|
||||
|
||||
$followupTypes = [
|
||||
'PENDING_MAKE_UP_EXAM_PROMOTION' => 'temporary_same_grade',
|
||||
'CLASS_REASSIGNMENT_REQUIRED' => 'manual_class_required',
|
||||
'COMPLETION_OR_EXIT_PROCESS_REQUIRED' => 'exit_required',
|
||||
];
|
||||
|
||||
@@ -1251,7 +1251,7 @@ class EnrollmentAdminController extends BaseController
|
||||
|
||||
$builder = $this->db->table('enrollment_flags')
|
||||
->where('status', 'open')
|
||||
->where('flag_type !=', 'CLASS_CAPACITY_EXCEPTION_REQUIRED');
|
||||
->whereNotIn('flag_type', ['CLASS_CAPACITY_EXCEPTION_REQUIRED', 'CLASS_REASSIGNMENT_REQUIRED']);
|
||||
if ($schoolYear !== '') {
|
||||
$builder->where('school_year', $schoolYear);
|
||||
}
|
||||
@@ -1268,7 +1268,7 @@ class EnrollmentAdminController extends BaseController
|
||||
$types = array_column(
|
||||
$this->db->table('enrollment_flags')
|
||||
->select('flag_type')
|
||||
->where('flag_type !=', 'CLASS_CAPACITY_EXCEPTION_REQUIRED')
|
||||
->whereNotIn('flag_type', ['CLASS_CAPACITY_EXCEPTION_REQUIRED', 'CLASS_REASSIGNMENT_REQUIRED'])
|
||||
->distinct()
|
||||
->orderBy('flag_type')
|
||||
->get()
|
||||
@@ -1276,7 +1276,10 @@ class EnrollmentAdminController extends BaseController
|
||||
'flag_type'
|
||||
);
|
||||
|
||||
return array_values(array_filter($types, static fn ($type): bool => (string) $type !== 'CLASS_CAPACITY_EXCEPTION_REQUIRED'));
|
||||
return array_values(array_filter(
|
||||
$types,
|
||||
static fn ($type): bool => ! in_array((string) $type, ['CLASS_CAPACITY_EXCEPTION_REQUIRED', 'CLASS_REASSIGNMENT_REQUIRED'], true)
|
||||
));
|
||||
}
|
||||
|
||||
private function schoolYears(): array
|
||||
|
||||
@@ -730,12 +730,19 @@ class InvoiceController extends ResourceController
|
||||
|
||||
$grade = 'N/A';
|
||||
if ($studentClass && isset($studentClass['class_section_id'])) {
|
||||
$classSection = $this->db->table('classSection')
|
||||
->where('class_section_id', $studentClass['class_section_id'])
|
||||
->get()
|
||||
->getRowArray();
|
||||
if ($classSection && isset($classSection['class_section_name'])) {
|
||||
$grade = $classSection['class_section_name'];
|
||||
$classSectionBuilder = $this->db->table('classSection')
|
||||
->select('classSection.class_section_id, classSection.class_section_name, classSection.class_id, classes.class_name')
|
||||
->join('classes', 'classes.id = classSection.class_id', 'left')
|
||||
->where('classSection.class_section_id', $studentClass['class_section_id']);
|
||||
if ($this->db->fieldExists('school_year', 'classSection')) {
|
||||
$classSectionBuilder->orderBy('classSection.school_year = ' . $this->db->escape($schoolYear), 'DESC', false);
|
||||
}
|
||||
$classSectionBuilder->orderBy('classSection.id', 'DESC');
|
||||
$classSection = $classSectionBuilder->get()->getRowArray();
|
||||
if ($classSection) {
|
||||
$grade = $this->invoiceManagementGradeLabel($classSection, $student);
|
||||
} elseif ($this->isKindergarten((string) ($student['registration_grade'] ?? ''))) {
|
||||
$grade = 'KG';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,6 +778,24 @@ class InvoiceController extends ResourceController
|
||||
];
|
||||
}
|
||||
|
||||
private function invoiceManagementGradeLabel(array $classSection, array $student): string
|
||||
{
|
||||
$registrationGrade = trim((string) ($student['registration_grade'] ?? ''));
|
||||
$classId = (int) ($classSection['class_id'] ?? 0);
|
||||
$className = trim((string) ($classSection['class_name'] ?? ''));
|
||||
$sectionName = trim((string) ($classSection['class_section_name'] ?? ''));
|
||||
|
||||
if ($classId === 13 || $this->isKindergarten($className) || $this->isKindergarten($registrationGrade)) {
|
||||
return 'KG';
|
||||
}
|
||||
|
||||
if ($sectionName === '13') {
|
||||
return 'KG';
|
||||
}
|
||||
|
||||
return $sectionName !== '' ? $sectionName : ($className !== '' ? $className : 'N/A');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
|
||||
@@ -2897,12 +2897,17 @@ class ParentController extends BaseController
|
||||
$lnKey = mb_strtolower(trim(preg_replace('/\s+/', ' ', $lastName)), 'UTF-8');
|
||||
$dobStr = $dobObj->format('Y-m-d');
|
||||
|
||||
$existing = $this->studentModel
|
||||
->where('school_year', $schoolYear)
|
||||
->where('dob', $dobStr)
|
||||
->where('firstname', $firstName) // already normalized above
|
||||
->where('lastname', $lastName) // already normalized above
|
||||
->first();
|
||||
$existingBuilder = $this->studentModel
|
||||
->where('parent_id', (int) $parentId)
|
||||
->where('dob', $dobStr)
|
||||
->where('firstname', $firstName) // already normalized above
|
||||
->where('lastname', $lastName); // already normalized above
|
||||
|
||||
if ($this->db->fieldExists('school_year', 'students')) {
|
||||
$existingBuilder->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
$existing = $existingBuilder->first();
|
||||
|
||||
if (!$studentId && $existing) {
|
||||
session()->setFlashdata(
|
||||
|
||||
Reference in New Issue
Block a user