diff --git a/add_form.php b/add_form.php index 3fef14a..a1c6b69 100644 --- a/add_form.php +++ b/add_form.php @@ -327,7 +327,7 @@ class mod_attendance_add_form extends moodleform { $this->_form->setConstant('previoussessiondate', $data['sessiondate']); } - if ($data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { + if (!empty($data['studentscanmark']) && $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/update_form.php b/update_form.php index a96e5c6..a9c0623 100644 --- a/update_form.php +++ b/update_form.php @@ -204,7 +204,7 @@ class mod_attendance_update_form extends moodleform { $errors['sestime'] = get_string('invalidsessionendtime', 'attendance'); } - if ($data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { + if (!empty($data['studentscanmark']) && $data['automark'] == ATTENDANCE_AUTOMARK_CLOSE) { $cm = $this->_customdata['cm']; // Check that the selected statusset has a status to use when unmarked. $sql = 'SELECT id