fix: adopt new services sections in optional services list

This commit is contained in:
Björn Fromme
2025-08-25 11:51:25 +02:00
parent 774aef364d
commit a29f49e637
@@ -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;