Skip to content

Commit

Permalink
MDL-32827 calendar: Added logic to handle calendar events with empty …
Browse files Browse the repository at this point in the history
…eventtypes during restore
  • Loading branch information
ankitagarwal committed Jul 27, 2012
1 parent fcda7db commit 0bdf18a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backup/moodle2/restore_stepslib.php
Expand Up @@ -1737,6 +1737,23 @@ public function process_calendarevents($data) {
return;
}
}
// Handle events with empty eventtype //MDL-32827
if(empty($data->eventtype)) {
if ($data->courseid == $SITE->id) { // Site event
$data->eventtype = "site";
} else if ($data->courseid != 0 && $data->groupid == 0 && ($data->modulename == 'assignment' || $data->modulename == 'assign')) {
// Course assingment event
$data->eventtype = "due";
} else if ($data->courseid != 0 && $data->groupid == 0) { // Course event
$data->eventtype = "course";
} else if ($data->groupid) { // Group event
$data->eventtype = "group";
} else if ($data->userid) { // User event
$data->eventtype = "user";
} else {
return;
}
}

$params = array(
'name' => $data->name,
Expand Down

0 comments on commit 0bdf18a

Please sign in to comment.