wip: booking process, refactor participant room assignment logic
This commit is contained in:
@@ -187,20 +187,24 @@ class Booking
|
||||
|
||||
// Sum up all services
|
||||
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])) {
|
||||
$price += $service->individualPrice[$participantIndex];
|
||||
}
|
||||
}
|
||||
|
||||
// Sum up all surcharges
|
||||
foreach ($this->surcharges as $surcharge) {
|
||||
if (in_array($participantIndex, $surcharge->mapping)) {
|
||||
if (in_array($participantIndex, $surcharge->mapping)
|
||||
&& isset($surcharge->individualPrice[$participantIndex])) {
|
||||
$price += $surcharge->individualPrice[$participantIndex];
|
||||
}
|
||||
}
|
||||
|
||||
$room = $this->getRoomForParticipant($participantIndex);
|
||||
$price += $room->individualPrice[$participantIndex];
|
||||
if (null !== $room && isset($room->individualPrice[$participantIndex])) {
|
||||
$price += $room->individualPrice[$participantIndex];
|
||||
}
|
||||
|
||||
return $price;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user