feat: proper determination of agency initiated bookings
For booking that are agency initiated (groups) different rules apply concerning mutability and requirement of personal data and whether the first participant is the applicant or not. This commit adds logic to evaluate the agency id assigned to the booking data to decide.
This commit is contained in:
@@ -7,7 +7,6 @@ namespace App\Form\Service;
|
||||
use App\BusProNet\Utility\DirectionMapper;
|
||||
use App\Form\Service\Abstract\AbstractFieldStateProvider;
|
||||
use App\Form\Service\Condition\AgeRangeCondition;
|
||||
use App\Form\Service\Condition\AuthenticatedUserPersonalDataCondition;
|
||||
use App\Form\Service\Condition\BabyAgeCondition;
|
||||
use App\Form\Service\Condition\BookingEligibilityCondition;
|
||||
use App\Form\Service\Condition\BulkInsuranceBookingCondition;
|
||||
@@ -16,6 +15,7 @@ use App\Form\Service\Condition\DateOfBirthProvidedCondition;
|
||||
use App\Form\Service\Condition\FieldValueCondition;
|
||||
use App\Form\Service\Condition\FinalBookingOnlyCondition;
|
||||
use App\Form\Service\Condition\FirstParticipantCondition;
|
||||
use App\Form\Service\Condition\FirstParticipantReadOnlyCondition;
|
||||
use App\Form\Service\Condition\MultipleParticipantsCondition;
|
||||
use App\Form\Service\Condition\RentalInsuranceAvailableCondition;
|
||||
use App\Form\Service\Condition\RentalSelectionCondition;
|
||||
@@ -80,59 +80,60 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
$rentalCondition = new RentalSelectionCondition();
|
||||
$skiPassCondition = new SkiPassSelectionCondition();
|
||||
|
||||
// Authenticated user personal data protection
|
||||
// Render personal data fields as static text for participants linked to BPN accounts (prevents duplicate records)
|
||||
$authenticatedUserCondition = new AuthenticatedUserPersonalDataCondition();
|
||||
// First participant read-only condition
|
||||
// Render personal data fields as static text for first participant in non-internal agency bookings
|
||||
// when user is logged in (data is prepopulated from BPN account)
|
||||
$firstParticipantReadOnlyCondition = new FirstParticipantReadOnlyCondition();
|
||||
|
||||
$this->fieldStateConditions['firstName'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['lastName'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['gender'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['nationality'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['dateOfBirth'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['email'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
// Mobile field: static text for authenticated users, required for first participant (guest bookings)
|
||||
// Mobile field: static text for first participant (when read-only), required for first participant (guest bookings)
|
||||
$this->fieldStateConditions['mobile'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
'required' => new FirstParticipantCondition(),
|
||||
];
|
||||
|
||||
// Address subfields - must render as static text to prevent creating duplicate BPN records
|
||||
$this->fieldStateConditions['address.street'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['address.postCode'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['address.city'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['address.country'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
$this->fieldStateConditions['address.district'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
];
|
||||
|
||||
// Note: Body dimensions (height, weight, shoeSize) are NOT hidden for authenticated users
|
||||
@@ -280,9 +281,9 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
];
|
||||
|
||||
// Make address field required for first participant (index 0)
|
||||
// Also render as static text for authenticated users to prevent duplicate BPN records
|
||||
// Also render as static text for first participant when read-only
|
||||
$this->fieldStateConditions['address'] = [
|
||||
'static_text' => $authenticatedUserCondition,
|
||||
'static_text' => $firstParticipantReadOnlyCondition,
|
||||
'required' => new FirstParticipantCondition(),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user