Commit 33d0cb3c authored by David Mudrák's avatar David Mudrák
Browse files

MDL-25660 workshop removes its calendar events on instance deletion

parent cb48a42a
......@@ -219,6 +219,13 @@ function workshop_delete_instance($id) {
call_user_func($classname.'::delete_instance', $workshop->id);
}
// delete the calendar events
$events = $DB->get_records('event', array('modulename' => 'workshop', 'instance' => $workshop->id));
foreach ($events as $event) {
$event = calendar_event::load($event);
$event->delete();
}
// finally remove the workshop record itself
$DB->delete_records('workshop', array('id' => $workshop->id));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment