Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ng event
  • Loading branch information...
commit 78f8349245a0dd9917469e22775981d8694e11d9 1 parent 9f786f7
@ankitagarwal ankitagarwal authored
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));
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.