Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-32827 calendar: Added logic to handle calendar events with empty …

…eventtypes during restore
  • Loading branch information...
commit 0bdf18a7c91472118f4a6188963fa89b22a2bf85 1 parent fcda7db
Ankit Agarwal ankitagarwal authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 backup/moodle2/restore_stepslib.php
17 backup/moodle2/restore_stepslib.php
View
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.