feat: move scope of enforced 'option' status to full booking
addresses #869chtfeq
This commit is contained in:
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Booking\Create;
|
||||
|
||||
use App\BusProNet\Constants;
|
||||
use App\Controller\Booking\Traits\BookingCreateTrait;
|
||||
use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
|
||||
use App\Controller\Booking\Traits\ParticipantCardFlowTrait;
|
||||
@@ -86,6 +85,7 @@ class Step2Controller extends AbstractController
|
||||
|
||||
// Preselect mandatory services
|
||||
$this->bookingService->preselectDefaultServices($bookingCreateDto);
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingCreateDto);
|
||||
|
||||
// Save BookingDto to session
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
@@ -162,8 +162,7 @@ class Step2Controller extends AbstractController
|
||||
// Keep behavior consistent with cards view: newly filled participant data
|
||||
// (especially dateOfBirth) must immediately trigger mandatory service preselection.
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
|
||||
$bookingDto->bookingStatus = Constants::BOOKING_STATUS_OPEN;
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
$this->bookingService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Recreate form with filled DTO so the view shows the dummy data
|
||||
@@ -176,6 +175,7 @@ class Step2Controller extends AbstractController
|
||||
// Re-run default preselection after participant form input changes (e.g. DOB).
|
||||
// This ensures auto-book defaults are applied as soon as eligibility becomes known.
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
}
|
||||
|
||||
// Collect notifications from field handlers (run during PRE_SUBMIT)
|
||||
|
||||
@@ -70,6 +70,8 @@ class Step3Controller extends AbstractController
|
||||
}
|
||||
|
||||
try {
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingCreateDto);
|
||||
|
||||
// Validate booking data with API by submitting an inquiry booking
|
||||
$inquiryResponse = $this->apiClient->createBookingInquiry($bookingCreateDto);
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ class Step4Controller extends AbstractController
|
||||
|
||||
if (true === $form->isSubmitted() && true === $form->isValid()) {
|
||||
try {
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingCreateDto);
|
||||
|
||||
// Submit final booking (already validated in Step 3)
|
||||
$bookingResponse = $this->apiClient->createBooking($bookingCreateDto);
|
||||
|
||||
|
||||
@@ -131,6 +131,9 @@ trait ParticipantCardFlowTrait
|
||||
|
||||
// Refresh endpoint is POST-only and always processes submitted participant data.
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
if (BookingDto::MODE_CREATE === $bookingDto->getMode()) {
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
}
|
||||
|
||||
// Recreate form so the rendered state reflects any new auto-preselections.
|
||||
$form = $this->createParticipantForm($bookingDto, $index, $refreshFormOptions);
|
||||
|
||||
Reference in New Issue
Block a user