fix: clear inquiry status on room reselection

This commit is contained in:
fromme committed 2026-10-20 09:41:33 +02:00
1 parent d4296f30a5
commit 32083c7966
3 files changed
+104 -11

No files matched your search

+24 -11
View File
@@ -85,6 +85,7 @@ class BookingConfigurator
? $this->agencyLoader->loadById($agencyId)?->code
: null;
$bookingCreateDto->bookingStatus = $bookingStatus;
$bookingCreateDto->initialBookingStatus = $bookingStatus;
$this->applyCreateBookingStatusRules($bookingCreateDto);
$this->bookingSessionService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
@@ -659,31 +660,43 @@ class BookingConfigurator
/**
* Updates booking status based on selected room requirements.
*
* Checks if any selected room has inquiry-only status. If so, forces
* the entire booking to inquiry mode. This override happens after room
* selection in Step 1 and respects the business rule: if ANY room requires
* inquiry, the whole booking becomes an inquiry.
* If ANY selected room is only bookable on request, 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, so a customer who swaps an on-request room for a
* free one in Step 1 is no longer submitted as an inquiry. An 'A' from the Step 3 BusPro
* fallback is cleared the same way; Step 3 validates again and re-applies it if needed.
*
* @param BookingDto $bookingDto The booking DTO to update
*/
public function updateBookingStatusFromRoomSelection(BookingDto $bookingDto): void
{
// Skip if already inquiry - no need to check
if ('A' === $bookingDto->bookingStatus) {
if (true === $this->hasOnRequestRoomSelected($bookingDto)) {
$bookingDto->bookingStatus = Constants::BOOKING_STATUS_INQUIRY;
return;
}
// Check selected rooms for inquiry-only status
// Sessions started before the initial status was recorded keep their current status
if (null === $bookingDto->initialBookingStatus) {
return;
}
$bookingDto->bookingStatus = $bookingDto->initialBookingStatus;
$this->applyCreateBookingStatusRules($bookingDto);
}
private function hasOnRequestRoomSelected(BookingDto $bookingDto): bool
{
foreach ($bookingDto->getSelectedRooms() as $roomSelection) {
$room = $bookingDto->travel->getRoomById($roomSelection->id);
if ($room
if (null !== $room
&& Constants::STATUS_ON_REQUEST === $room->status
&& $room->available > 0) {
$bookingDto->bookingStatus = 'A';
return;
return true;
}
}
return false;
}
/**