fix: adopt new services sections in optional services list
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user