From a29f49e6374060f1222904243695cff9d5905e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 25 Aug 2025 11:51:25 +0200 Subject: [PATCH] fix: adopt new services sections in optional services list --- .../Classes/Service/DateService.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php index da28f53c..bc9ef121 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php @@ -69,6 +69,18 @@ class DateService implements SingletonInterface 'KUR' => 'Kurse', 'VER' => 'Verleih', 'SON' => 'Sonstiges', + 'LVS' => 'Leihmaterial-Versicherung', + 'PAR' => 'Parkplatz', + ]; + + private $serviceSectionsMapping = [ + 'VE2' => 'VER', + 'VE3' => 'VER', + 'VE4' => 'VER', + 'VE5' => 'VER', + 'VE6' => 'VER', + 'VE7' => 'VER', + 'VE8' => 'VER', ]; /** @@ -248,13 +260,22 @@ class DateService implements SingletonInterface $processed = []; foreach ($servicesFlat as $key => $services) { + $servicesWithCosts = array_filter($services, function ($service) { + return '0,00' !== $service['price']; + }); + if (0 === count($servicesWithCosts)) { + continue; + } + if (array_key_exists($key, $this->serviceSectionsMapping)) { + $key = $this->serviceSectionsMapping[$key]; + } if (!array_key_exists($key, $processed)) { $processed[$key] = [ 'label' => $this->serviceSections[$key], 'services' => [], ]; - $processed[$key]['services'] += $services; } + $processed[$key]['services'] += $servicesWithCosts; } return $processed;