From 19b81724f0db734ddef9a9aea1066befc9cb65b5 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 25 Aug 2021 20:53:13 +1200 Subject: [PATCH] fix validation check. --- classes/form/addsession.php | 4 +++- classes/form/updatesession.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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