From fdc342bab8eb7dff1e0e42e9adb524d34d22b229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 21 Apr 2020 18:09:42 +0200 Subject: [PATCH] Consider unavailable rooms as blocked --- .../ext/ep_products/Classes/Service/IcalService.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php b/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php index d7230c49..be97b8a1 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/IcalService.php @@ -128,7 +128,9 @@ class IcalService implements SingletonInterface foreach ($events as $event) { /** @var Contingent $event */ - if (null === $item && (Contingent::STATUS_BLOCKED === $event->getStatus() || Contingent::STATUS_ONREQUEST === $event->getStatus())) { + $isBlocked = Contingent::STATUS_BLOCKED === $event->getStatus() || Contingent::STATUS_ONREQUEST === $event->getStatus(); + $isUnavailable = 0 === $event->getAvailable(); + if (null === $item && ($isBlocked || $isUnavailable)) { $item = [ 'from' => $event->getBegin(), ]; @@ -138,6 +140,11 @@ class IcalService implements SingletonInterface $item = null; } } + + if (isset($event) && null !== $item && !isset($item['to'])) { + $item['to'] = $event->getEnd(); + $this->addBlockedItem($item); + } } /** @@ -160,7 +167,7 @@ class IcalService implements SingletonInterface /** * @param array $item */ - protected function addOccupancyItem( array $item): void + protected function addOccupancyItem(array $item): void { if (0 === $item['occupancy']) { return;