Fix semester context, attendance rosters, and billing workflows
- load global semester helpers consistently and use date-based semester defaults - fix grading and daily attendance duplicate student/section rows - keep attendance violations scoped to the current semester by default - update invoice, refund, discount, payment, and financial aid flows - add configuration cleanup migrations for duplicate calendar/semester keys - refresh parent registration/report-card and print request handling - update related models, services, views, cron notes, and test coverage
This commit is contained in:
@@ -40,7 +40,7 @@ class AttendanceTrackingController extends BaseController
|
||||
$this->db = \Config\Database::connect();
|
||||
$this->notificationModel = new ParentNotificationModel();
|
||||
$this->attendanceEmailTemplateModel = new AttendanceEmailTemplateModel();
|
||||
$this->semester = (string) $this->configModel->getConfig('semester');
|
||||
$this->semester = (string) getSemester();
|
||||
$this->schoolYear = (string) $this->configModel->getConfig('school_year');
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ class AttendanceTrackingController extends BaseController
|
||||
$syParam = $this->request->getGet('school_year');
|
||||
$semParam = $this->request->getGet('semester');
|
||||
$schoolYear = (is_string($syParam) && $syParam !== '') ? (string)$syParam : (string)$this->schoolYear;
|
||||
$semester = (is_string($semParam) && $semParam !== '') ? (string)$semParam : null; // semester filter disabled
|
||||
$semester = (is_string($semParam) && $semParam !== '') ? (string)$semParam : (string)$this->semester;
|
||||
$semesterWasRequested = is_string($semParam) && $semParam !== '';
|
||||
|
||||
$debugInfo = [
|
||||
'school_year_param' => $schoolYear,
|
||||
@@ -325,7 +326,8 @@ class AttendanceTrackingController extends BaseController
|
||||
'semester' => $semester,
|
||||
'student_ids' => $studentIds,
|
||||
]);
|
||||
// Second chance: detect the latest attendance_data term for these students
|
||||
// Second chance: detect the latest attendance_data term only when the user has not
|
||||
// requested a semester and the date-based current semester is unavailable.
|
||||
$latestAttendanceTerm = $this->db->table('attendance_data')
|
||||
->select('school_year, semester, date')
|
||||
->whereIn('student_id', $studentIds)
|
||||
@@ -334,7 +336,7 @@ class AttendanceTrackingController extends BaseController
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if ($latestAttendanceTerm) {
|
||||
if ($latestAttendanceTerm && !$semesterWasRequested && trim($semester) === '') {
|
||||
$schoolYear = !empty($latestAttendanceTerm['school_year'])
|
||||
? (string)$latestAttendanceTerm['school_year']
|
||||
: $schoolYear;
|
||||
@@ -2140,7 +2142,7 @@ class AttendanceTrackingController extends BaseController
|
||||
$wrapped = $this->renderWithEmailLayout($subject, $safeHtmlBody);
|
||||
|
||||
// Resolve term (prefer controller properties if set)
|
||||
$semester = $this->semester ?? (new \App\Models\ConfigurationModel())->getConfig('semester');
|
||||
$semester = $this->semester ?? getSemester();
|
||||
$schoolYear = $this->schoolYear ?? (new \App\Models\ConfigurationModel())->getConfig('school_year');
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user