fix: don't rely on individual prices being available for all participants

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent 61d4e36f1f
commit cc8500d0f4
+3 -3
View File
@@ -249,7 +249,7 @@ class Booking
foreach ([...$this->transportationServices, ...$this->additionalServices] as $service) { foreach ([...$this->transportationServices, ...$this->additionalServices] as $service) {
if ((in_array($participantIndex, $service->mapping) || true === $service->mandatory) if ((in_array($participantIndex, $service->mapping) || true === $service->mandatory)
&& isset($service->individualPrice[$participantIndex])) { && isset($service->individualPrice[$participantIndex])) {
$price += $service->individualPrice[$participantIndex]; $price += $service->individualPrice[$participantIndex] ?? 0;
} }
} }
@@ -257,13 +257,13 @@ class Booking
foreach ($this->surcharges as $surcharge) { foreach ($this->surcharges as $surcharge) {
if (in_array($participantIndex, $surcharge->mapping) if (in_array($participantIndex, $surcharge->mapping)
&& isset($surcharge->individualPrice[$participantIndex])) { && isset($surcharge->individualPrice[$participantIndex])) {
$price += $surcharge->individualPrice[$participantIndex]; $price += $surcharge->individualPrice[$participantIndex] ?? 0;
} }
} }
$room = $this->getRoomForParticipant($participantIndex); $room = $this->getRoomForParticipant($participantIndex);
if (null !== $room && isset($room->individualPrice[$participantIndex])) { if (null !== $room && isset($room->individualPrice[$participantIndex])) {
$price += $room->individualPrice[$participantIndex]; $price += $room->individualPrice[$participantIndex] ?? 0;
} }
return $price; return $price;