Browse Source

Prevent Calendarevent value being set when disabled at site level.

MOODLE_36_STABLE
Dan Marsden 6 years ago
parent
commit
b6b4dc920e
  1. 7
      classes/structure.php

7
classes/structure.php

@ -454,13 +454,18 @@ class mod_attendance_structure {
public function add_sessions($sessions) { public function add_sessions($sessions) {
global $DB; global $DB;
$config = get_config('attendance');
foreach ($sessions as $sess) { foreach ($sessions as $sess) {
$sess->attendanceid = $this->id; $sess->attendanceid = $this->id;
$sess->automarkcompleted = 0; $sess->automarkcompleted = 0;
if (!isset($sess->automark)) { if (!isset($sess->automark)) {
$sess->automark = 0; $sess->automark = 0;
} }
if (empty($config->enablecalendar)) {
// If calendard disabled at site level, don't use it.
$sess->calendarevent = 0;
}
$sess->id = $DB->insert_record('attendance_sessions', $sess); $sess->id = $DB->insert_record('attendance_sessions', $sess);
$description = file_save_draft_area_files($sess->descriptionitemid, $description = file_save_draft_area_files($sess->descriptionitemid,
$this->context->id, 'mod_attendance', 'session', $sess->id, $this->context->id, 'mod_attendance', 'session', $sess->id,

Loading…
Cancel
Save