diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php index 2a842c8d..d7d59d5f 100644 --- a/includes/pages/schedule/ImportSchedule.php +++ b/includes/pages/schedule/ImportSchedule.php @@ -92,7 +92,10 @@ class ImportSchedule extends BaseController { $scheduleId = $request->getAttribute('schedule_id'); // optional - $schedule = ScheduleUrl::findOrFail($scheduleId); + $schedule = ScheduleUrl::find($scheduleId); + if ($schedule == null) { + $schedule = new ScheduleUrl(); + } return $this->response->withView( 'admin/schedule/edit.twig', @@ -421,6 +424,7 @@ class ImportSchedule extends BaseController $scheduleShift = ScheduleShift::whereGuid($event->getGuid())->where('schedule_id', $schedule->id)->first(); $shift = $scheduleShift->shift; $shift->delete(); + $scheduleShift->delete(); $this->fireDeleteShiftEntryEvents($event, $schedule);