mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-31671-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE
This commit is contained in:
commit
329920fa22
1 changed files with 14 additions and 0 deletions
|
@ -2088,6 +2088,20 @@ class calendar_event {
|
|||
// Delete the event
|
||||
$DB->delete_records('event', array('id'=>$this->properties->id));
|
||||
|
||||
// If we are deleting parent of a repeated event series, promote the next event in the series as parent
|
||||
if (($this->properties->id == $this->properties->repeatid) && !$deleterepeated) {
|
||||
$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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the editor context hasn't already been set then set it now
|
||||
if ($this->editorcontext === null) {
|
||||
$this->editorcontext = $this->properties->context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue