Skip to content
Browse files

MDL-31671 calendar: update_event hook should be triggered when updati…

…ng event
  • Loading branch information...
1 parent d28da62 commit 47b43d0b4cda3f8c5cb25dfc33b86cd234f5ef4f @ankitagarwal ankitagarwal committed May 1, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 calendar/lib.php
View
6 calendar/lib.php
@@ -2092,6 +2092,12 @@ public function delete($deleterepeated=false) {
$newparent = $DB->get_field_sql("SELECT id from {event} where repeatid = ? order by id ASC", array($this->properties->id), IGNORE_MULTIPLE);
if (!empty($newparent)) {
$DB->execute("UPDATE {event} SET repeatid = ? WHERE repeatid = ?", array($newparent, $this->properties->id));
+ // Get all records where the repeatid is the same as the event being removed
+ $events = $DB->get_records('event', array('repeatid' => $newparent));
+ // For each of the returned events trigger the event_update hook.
+ foreach ($events as $event) {
+ self::calendar_event_hook('update_event', array($event, false));
+ }
}
}

0 comments on commit 47b43d0

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