Skip to content

Commit

Permalink
MDL-31671 calendar: update_event hook should be triggered when updati…
Browse files Browse the repository at this point in the history
…ng event
  • Loading branch information
ankitagarwal committed May 7, 2012
1 parent 9f786f7 commit 78f8349
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions calendar/lib.php
Expand Up @@ -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));
}
}
}

Expand Down

0 comments on commit 78f8349

Please sign in to comment.