Merge branch 'hotfix/contingents-ical-fix'

This commit is contained in:
Björn Fromme
2020-04-21 18:09:46 +02:00
@@ -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;