MDL-31671 calendar: update_event hook should be triggered when updating event

This commit is contained in:
Ankit Agarwal
2012-05-07 15:04:56 +08:00
parent d28da62e34
commit 47b43d0b4c
+6
View File
@@ -2092,6 +2092,12 @@ class calendar_event {
$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));
}
}
}