feat: offer rooms on request by Anf code suffix

This commit is contained in:
fromme committed 2026-11-11 11:35:38 +01:00
1 parent 2936d8947a
commit 0b0286787b
11 files changed
+204 -41

No files matched your search

+24 -4
View File
@@ -648,16 +648,24 @@ class BookingConfigurator
}
/**
* Resets the booking status after the room selection in Step 1.
* Updates the booking status after the room selection in Step 1.
*
* The status returns to what the travel called for when the booking started, and the
* create-flow rules run again. An 'A' from the Step 3 BusPro fallback is cleared this way;
* Step 3 validates again with the new rooms and re-applies it if needed.
* If any selected room is on request, which Step 1 offers only for rooms the office sells
* that way on purpose (Room::isBookableState()), the whole booking becomes an inquiry.
* Otherwise the status returns to what the travel called for when the booking started,
* and the create-flow rules run again. An 'A' from the Step 3 BusPro fallback is cleared
* this way; Step 3 validates again with the new rooms and re-applies it if needed.
*
* @param BookingDto $bookingDto The booking DTO to update
*/
public function updateBookingStatusFromRoomSelection(BookingDto $bookingDto): void
{
if ($this->hasOnRequestRoomSelected($bookingDto)) {
$bookingDto->bookingStatus = Constants::BOOKING_STATUS_INQUIRY;
return;
}
// Sessions started before the initial status was recorded keep their current status
if (null === $bookingDto->initialBookingStatus) {
return;
@@ -667,6 +675,18 @@ class BookingConfigurator
$this->applyCreateBookingStatusRules($bookingDto);
}
private function hasOnRequestRoomSelected(BookingDto $bookingDto): bool
{
foreach ($bookingDto->getSelectedRooms() as $roomSelection) {
$room = $bookingDto->travel->getRoomById($roomSelection->id);
if (null !== $room && Constants::STATUS_ON_REQUEST === $room->status) {
return true;
}
}
return false;
}
/**
* Applies booking-level status rules in create flow.
*