From 6428642adb3d668494ef22ad3a184fad889609f4 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Fri, 20 Oct 2017 15:37:15 +0800 Subject: [PATCH] MDL-60429 calendar: update group and course id for repeated events --- calendar/lib.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index ef5a16f598d..0cc3341543e 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -443,7 +443,6 @@ class calendar_event { ); if (empty($this->properties->id) || $this->properties->id < 1) { - if ($checkcapability) { if (!calendar_add_event_allowed($this->properties)) { print_error('nopermissiontoupdatecalendar'); @@ -596,14 +595,25 @@ class calendar_event { description = ?, timestart = timestart + ?, timeduration = ?, - timemodified = ? + timemodified = ?, + groupid = ?, + courseid = ? WHERE repeatid = ?"; $params = array($this->properties->name, $this->properties->description, $timestartoffset, - $this->properties->timeduration, time(), $event->repeatid); + $this->properties->timeduration, time(), $this->properties->groupid, + $this->properties->courseid, $event->repeatid); } else { - $sql = "UPDATE {event} SET name = ?, description = ?, timeduration = ?, timemodified = ? WHERE repeatid = ?"; + $sql = "UPDATE {event} + SET name = ?, + description = ?, + timeduration = ?, + timemodified = ?, + groupid = ?, + courseid = ? + WHERE repeatid = ?"; $params = array($this->properties->name, $this->properties->description, - $this->properties->timeduration, time(), $event->repeatid); + $this->properties->timeduration, time(), $this->properties->groupid, + $this->properties->courseid, $event->repeatid); } $DB->execute($sql, $params);