diff --git a/app/controllers/calendar/date.php b/app/controllers/calendar/date.php index 755ef97509a5371b29d2497cd1ac7516f9e37bf3..cd876ed76f447242cbd1fff156f5a9ec7ad0860b 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);