From: Dan Marsden Date: Fri, 28 Apr 2017 03:28:42 +0000 (+1200) Subject: set default values a bit better. X-Git-Url: http://git.cameron1729.xyz/?a=commitdiff_plain;h=35a553661bc8d5a7569bdd6d2e551a443e20df9a;p=moodle-mod_attendance.git set default values a bit better. --- diff --git a/classes/structure.php b/classes/structure.php index 8064f50..3506217 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -395,6 +395,7 @@ class mod_attendance_structure { $sess->lasttaken = 0; $sess->lasttakenby = 0; $sess->studentscanmark = 0; + $sess->studentpassword = ''; $event->add_record_snapshot('attendance_sessions', $sess); $event->trigger(); diff --git a/sessions.php b/sessions.php index e527c59..40b9e9e 100644 --- a/sessions.php +++ b/sessions.php @@ -294,11 +294,11 @@ function construct_sessions_data_for_add($formdata) { $sess->description = $formdata->sdescription['text']; $sess->descriptionformat = $formdata->sdescription['format']; $sess->timemodified = $now; - if (isset($formdata->studentscanmark)) { // Students will be able to mark their own attendance. + $sess->studentscanmark = 0; + $sess->studentpassword = ''; + if (isset($formdata->studentscanmark) && !empty($formdata->studentscanmark)) { // Students will be able to mark their own attendance. $sess->studentscanmark = 1; $sess->studentpassword = $formdata->studentpassword; - } else { - $sess->studentpassword = ''; } $sess->statusset = $formdata->statusset;