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
|
// Sum up all services
|
||||||
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) {
|
||||||
$price += $service->individualPrice[$participantIndex];
|
$price += $service->individualPrice[$participantIndex] ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sum up all surcharges
|
// Sum up all surcharges
|
||||||
foreach ($this->surcharges as $surcharge) {
|
foreach ($this->surcharges as $surcharge) {
|
||||||
if (in_array($participantIndex, $surcharge->mapping)) {
|
if (in_array($participantIndex, $surcharge->mapping)) {
|
||||||
$price += $surcharge->individualPrice[$participantIndex];
|
$price += $surcharge->individualPrice[$participantIndex] ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$room = $this->getRoomForParticipant($participantIndex);
|
if (null !== $room = $this->getRoomForParticipant($participantIndex)) {
|
||||||
$price += $room->individualPrice[$participantIndex];
|
$price += $room->individualPrice[$participantIndex] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
return $price;
|
return $price;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user