From ea9aa9ef40d4dfd3c5ed914ee40d5249e311d7bc Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 27 Dec 2023 12:47:49 +0100 Subject: [PATCH] fixes --- includes/pages/schedule/ImportSchedule.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);