fix all issues before deploy
This commit is contained in:
@@ -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>>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user