Permalink
Browse files

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

…eventtypes during restore
  • Loading branch information...
1 parent 3713514 commit 686ca2f5d18732271e2c77bb952dd8ada30bd243 @ankitagarwal ankitagarwal committed Jul 25, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 backup/moodle2/restore_stepslib.php
@@ -1769,6 +1769,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,

0 comments on commit 686ca2f

Please sign in to comment.