Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 1 changed file with 17 additions and 0 deletions. Show diff stats Hide diff stats

  1. +17 0 backup/moodle2/restore_stepslib.php
17 backup/moodle2/restore_stepslib.php
@@ -1737,6 +1737,23 @@ public function process_calendarevents($data) {
1737 1737 return;
1738 1738 }
1739 1739 }
  1740 + // Handle events with empty eventtype //MDL-32827
  1741 + if(empty($data->eventtype)) {
  1742 + if ($data->courseid == $SITE->id) { // Site event
  1743 + $data->eventtype = "site";
  1744 + } else if ($data->courseid != 0 && $data->groupid == 0 && ($data->modulename == 'assignment' || $data->modulename == 'assign')) {
  1745 + // Course assingment event
  1746 + $data->eventtype = "due";
  1747 + } else if ($data->courseid != 0 && $data->groupid == 0) { // Course event
  1748 + $data->eventtype = "course";
  1749 + } else if ($data->groupid) { // Group event
  1750 + $data->eventtype = "group";
  1751 + } else if ($data->userid) { // User event
  1752 + $data->eventtype = "user";
  1753 + } else {
  1754 + return;
  1755 + }
  1756 + }
1740 1757
1741 1758 $params = array(
1742 1759 'name' => $data->name,

0 comments on commit 0bdf18a

Please sign in to comment.
Something went wrong with that request. Please try again.