Browse Source

Prevent Calendarevent value being set when disabled at site level.

MOODLE_35_STABLE
Dan Marsden 6 years ago
parent
commit
9bc4d9e8dd
  1. 7
      classes/structure.php

7
classes/structure.php

@ -454,13 +454,18 @@ class mod_attendance_structure {
public function add_sessions($sessions) {
global $DB;
$config = get_config('attendance');
foreach ($sessions as $sess) {
$sess->attendanceid = $this->id;
$sess->automarkcompleted = 0;
if (!isset($sess->automark)) {
$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);
$description = file_save_draft_area_files($sess->descriptionitemid,
$this->context->id, 'mod_attendance', 'session', $sess->id,

Loading…
Cancel
Save