fix: streamlined single room selection handling

This commit is contained in:
Björn Fromme
2025-10-28 16:12:27 +01:00
parent 5021f414d1
commit 3d694ed7eb
4 changed files with 36 additions and 18 deletions
@@ -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;
}