fix: don't rely on individual prices being available for all participants
This commit is contained in:
@@ -110,19 +110,20 @@ class Booking
|
||||
// Sum up all services
|
||||
foreach ([...$this->transportationServices, ...$this->additionalServices] as $service) {
|
||||
if (in_array($participantIndex, $service->mapping) || true === $service->mandatory) {
|
||||
$price += $service->individualPrice[$participantIndex];
|
||||
$price += $service->individualPrice[$participantIndex] ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Sum up all surcharges
|
||||
foreach ($this->surcharges as $surcharge) {
|
||||
if (in_array($participantIndex, $surcharge->mapping)) {
|
||||
$price += $surcharge->individualPrice[$participantIndex];
|
||||
$price += $surcharge->individualPrice[$participantIndex] ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
$room = $this->getRoomForParticipant($participantIndex);
|
||||
$price += $room->individualPrice[$participantIndex];
|
||||
if (null !== $room = $this->getRoomForParticipant($participantIndex)) {
|
||||
$price += $room->individualPrice[$participantIndex] ?? 0;
|
||||
}
|
||||
|
||||
return $price;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user