diff --git a/app/controllers/calendar/date.php b/app/controllers/calendar/date.php index 84b429422cccce12b2ecafdd174e79c358d73ca0..fea47d2ba88789e170f8fce4bb9980be40e217ed 100644 --- a/app/controllers/calendar/date.php +++ b/app/controllers/calendar/date.php @@ -565,6 +565,14 @@ class Calendar_DateController extends AuthenticatedController $assignment->store(); } } + //Remove the date from calendars that are not in the $valid_assigned_calendar_ids array: + CalendarDateAssignment::deleteBySQL( + '`range_id` NOT IN ( :assigned_calendar_ids ) AND `calendar_date_id` = :calendar_date_id', + [ + 'assigned_calendar_ids' => $valid_assigned_calendar_ids, + 'calendar_date_id' => $this->date->id + ] + ); //Clear all exceptions for the event and set them again: CalendarDateException::deleteByCalendar_date_id($this->date->id);