diff --git a/classes/form/addsession.php b/classes/form/addsession.php index 331f1fe..4f7d5b4 100644 --- a/classes/form/addsession.php +++ b/classes/form/addsession.php @@ -350,7 +350,9 @@ class addsession extends moodleform { $this->_form->setConstant('previoussessiondate', $sessstart); } - if (!empty($data['studentscanmark']) && $data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { + if (!empty($data['studentscanmark']) && isset($data['automark']) + && $data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { + $cm = $this->_customdata['cm']; // Check that the selected statusset has a status to use when unmarked. $sql = 'SELECT id diff --git a/classes/form/updatesession.php b/classes/form/updatesession.php index e3bdab9..748639c 100644 --- a/classes/form/updatesession.php +++ b/classes/form/updatesession.php @@ -223,7 +223,9 @@ class updatesession extends \moodleform { $errors['sestime'] = get_string('invalidsessionendtime', 'attendance'); } - if (!empty($data['studentscanmark']) && $data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { + if (!empty($data['studentscanmark']) && isset($data['automark']) + && $data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { + $cm = $this->_customdata['cm']; // Check that the selected statusset has a status to use when unmarked. $sql = 'SELECT id