diff --git a/add_form.php b/add_form.php index 51bffba..6cec532 100644 --- a/add_form.php +++ b/add_form.php @@ -158,6 +158,10 @@ class mod_attendance_add_form extends moodleform { public function validation($data, $files) { $errors = parent::validation($data, $files); + if ($data['sessiondate'] != 0 && $data['sessionenddate'] != 0 && $data['sessionenddate'] < $data['sessiondate']) { + $errors['sessionenddate'] = get_string('invalidsessionenddate', 'attendance'); + } + if ($data['sessiontype'] == attendance::SESSION_GROUP and empty($data['groups'])) { $errors['groups'] = get_string('errorgroupsnotselected', 'attendance'); } diff --git a/lang/en/attendance.php b/lang/en/attendance.php index f79b88a..3ade055 100755 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -121,6 +121,7 @@ $string['identifyby'] = 'Identify student by'; $string['includeall'] = 'Select all sessions'; $string['includenottaken'] = 'Include not taken sessions'; $string['indetail'] = 'In detail...'; +$string['invalidsessionenddate'] = 'The session end date can not be earlier than the session start date'; $string['jumpto'] = 'Jump to'; $string['modulename'] = 'Attendance'; $string['modulename_help'] = 'The attendance activity module enables a teacher to take attendance during class and students to view their own attendance record.