diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 69f5c8400c6..9955d09f6dd 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -1440,8 +1440,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) { // should not be set but just in case unset($event->id); } - // calendar_event::create will reuse a db record if the id field is set - calendar_event::create($event); + // update() will reuse a db record if the id field is set + $eventobj = new calendar_event($event); + $eventobj->update($event, false); } if ($workshop->submissionend) { @@ -1454,8 +1455,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) { // should not be set but just in case unset($event->id); } - // calendar_event::create will reuse a db record if the id field is set - calendar_event::create($event); + // update() will reuse a db record if the id field is set + $eventobj = new calendar_event($event); + $eventobj->update($event, false); } if ($workshop->assessmentstart) { @@ -1468,8 +1470,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) { // should not be set but just in case unset($event->id); } - // calendar_event::create will reuse a db record if the id field is set - calendar_event::create($event); + // update() will reuse a db record if the id field is set + $eventobj = new calendar_event($event); + $eventobj->update($event, false); } if ($workshop->assessmentend) { @@ -1482,8 +1485,9 @@ function workshop_calendar_update(stdClass $workshop, $cmid) { // should not be set but just in case unset($event->id); } - // calendar_event::create will reuse a db record if the id field is set - calendar_event::create($event); + // update() will reuse a db record if the id field is set + $eventobj = new calendar_event($event); + $eventobj->update($event, false); } // delete any leftover events