fix: streamlined single room selection handling
This commit is contained in:
@@ -14,6 +14,7 @@ use App\BusProNet\Utility\DirectionMapper;
|
||||
use App\Form\Model\BankAccountDto;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
|
||||
@@ -132,6 +133,22 @@ class BookingDataProcessor
|
||||
$dto->participants[$index] = $participantData;
|
||||
}
|
||||
|
||||
// Rebuild roomSelections array from booking room data
|
||||
// This is needed for conditions like SingleRoomTypeCondition that rely on roomSelections
|
||||
// The booking already contains rooms with actual quantities (anzahl from XML)
|
||||
$availableRooms = $travel->getAvailableRooms();
|
||||
foreach ($booking->rooms as $bookingRoom) {
|
||||
$room = $availableRooms[$bookingRoom->id] ?? null;
|
||||
if (null !== $room && null !== $bookingRoom->totalCount && $bookingRoom->totalCount > 0) {
|
||||
$roomSelection = new RoomSelectionDto();
|
||||
$roomSelection->roomId = $bookingRoom->id;
|
||||
$roomSelection->roomLabel = $room->label;
|
||||
$roomSelection->roomPrice = $room->price;
|
||||
$roomSelection->quantity = $bookingRoom->totalCount; // Actual quantity from booking XML (anzahl)
|
||||
$dto->roomSelections[] = $roomSelection;
|
||||
}
|
||||
}
|
||||
|
||||
return $dto;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user