From f38c0c6093261324ade69b5ae64ae696631a4188 Mon Sep 17 00:00:00 2001 From: Matheus Zych Date: Tue, 20 Jan 2026 13:33:46 +0100 Subject: [PATCH] BookingPool: Remove reservations on pool deletion See: https://mantis.ilias.de/view.php?id=21705 Deleting or trashing a booking pool left reservations and calendar entries behind. The Booking Manager module now listens for ILIAS object `delete` and `toTrash` events; `ObjectEvent::handleDeletion` resolves each affected pool and calls `ilBookingObject::deleteReservationsAndCalEntries` for every booking object. --- .../BookingManager/Objects/ObjectEvent.php | 48 +++++++++++++++++++ .../Service/class.InternalDomainService.php | 10 +++- ...class.ilBookingManagerAppEventListener.php | 8 ++++ components/ILIAS/BookingManager/module.xml | 3 +- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 components/ILIAS/BookingManager/Objects/ObjectEvent.php diff --git a/components/ILIAS/BookingManager/Objects/ObjectEvent.php b/components/ILIAS/BookingManager/Objects/ObjectEvent.php new file mode 100644 index 000000000000..f51b65947bf1 --- /dev/null +++ b/components/ILIAS/BookingManager/Objects/ObjectEvent.php @@ -0,0 +1,48 @@ +getId(); + } catch (ilObjectTypeMismatchException) { + continue; + } + + foreach (ilBookingObject::getList($pool_id) as $booking_object) { + $booking_object_id = $booking_object['booking_object_id'] ?? null; + if ($booking_object_id === null) { + continue; + } + + (new ilBookingObject($booking_object_id))->deleteReservationsAndCalEntries($booking_object_id); + } + } + } +} diff --git a/components/ILIAS/BookingManager/Service/class.InternalDomainService.php b/components/ILIAS/BookingManager/Service/class.InternalDomainService.php index ae2e292c8946..ab2fb7defe18 100755 --- a/components/ILIAS/BookingManager/Service/class.InternalDomainService.php +++ b/components/ILIAS/BookingManager/Service/class.InternalDomainService.php @@ -1,7 +1,5 @@ bookingManager()->internal()->domain()->objectEvent()->handleDeletion([$a_parameter["ref_id"]]); + break; + } + break; } } } diff --git a/components/ILIAS/BookingManager/module.xml b/components/ILIAS/BookingManager/module.xml index a5f775ba7db2..a981b186622d 100755 --- a/components/ILIAS/BookingManager/module.xml +++ b/components/ILIAS/BookingManager/module.xml @@ -5,7 +5,7 @@ cat crs @@ -17,6 +17,7 @@ +