From e50a47f9e430c9ef22938abd69e81d6d3f9bf3f9 Mon Sep 17 00:00:00 2001 From: ppound Date: Mon, 29 Nov 2021 10:41:48 -0400 Subject: [PATCH] fixed bug when deleting an entity that has associated reservations --- src/Controller/CalendarController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Controller/CalendarController.php b/src/Controller/CalendarController.php index 8570f11..5db5e14 100644 --- a/src/Controller/CalendarController.php +++ b/src/Controller/CalendarController.php @@ -234,9 +234,13 @@ class CalendarController extends ControllerBase { // add in pre/post buffer for setup/takedown (rev 7.x-1.3+) // - if the slot is part of buffer we add "setup" to class // - if we don't have admin rights; we also mark it as booked so no one can book in these slots - $category = $categories[$entities[$rid]->$category_field->getString()]; - $preslots = $category['prebuffer'] / 30; - $postslots = $category['postbuffer'] / 30; + $preslots = 0; + $postslots = 0; + if(isset($entities[$rid])) { + $category = $categories[$entities[$rid]->$category_field->getString()]; + $preslots = $category['prebuffer'] / 30; + $postslots = $category['postbuffer'] / 30; + } $startkey = array_search($reservations[$rid][$time]['time'], $times); $endkey = $startkey + $time_slots; $k = $startkey - $preslots;