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:
@@ -9,12 +9,12 @@ use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractFieldStateProvider;
|
||||
use App\Form\Service\Condition\AdditionalServicesMutabilityCondition;
|
||||
use App\Form\Service\Condition\AgeRangeCondition;
|
||||
use App\Form\Service\Condition\AuthenticatedUserPersonalDataCondition;
|
||||
use App\Form\Service\Condition\BookingModeCondition;
|
||||
use App\Form\Service\Condition\CompositeCondition;
|
||||
use App\Form\Service\Condition\DateOfBirthProvidedCondition;
|
||||
use App\Form\Service\Condition\FieldValueCondition;
|
||||
use App\Form\Service\Condition\FirstParticipantCondition;
|
||||
use App\Form\Service\Condition\FirstParticipantReadOnlyCondition;
|
||||
use App\Form\Service\Condition\PersonalDataMutabilityCondition;
|
||||
use App\Form\Service\Condition\PickupsMutabilityCondition;
|
||||
use App\Form\Service\Condition\RentalInsuranceAvailableCondition;
|
||||
@@ -50,17 +50,17 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
|
||||
$pickupsMutabilityCondition = new PickupsMutabilityCondition();
|
||||
|
||||
// Personal data protection in edit mode:
|
||||
// 1. Participant with personId (linked to BPN account) - edit via personal data form instead
|
||||
// 1. First participant in non-internal agency booking - always read-only (first participant = applicant)
|
||||
// 2. BPN mutability flag (mutable=false) - respects BPN business rules
|
||||
// Show fields as static text if EITHER condition is true
|
||||
$authenticatedUserCondition = new AuthenticatedUserPersonalDataCondition();
|
||||
$firstParticipantReadOnlyCondition = new FirstParticipantReadOnlyCondition();
|
||||
$personalDataMutabilityCondition = new PersonalDataMutabilityCondition();
|
||||
$personalDataHiddenCondition = CompositeCondition::or(
|
||||
$authenticatedUserCondition,
|
||||
$firstParticipantReadOnlyCondition,
|
||||
$personalDataMutabilityCondition
|
||||
);
|
||||
|
||||
// Render all personal data fields as static text if authenticated user OR BPN indicates not mutable
|
||||
// Render all personal data fields as static text if first participant in non-internal agency OR BPN indicates not mutable
|
||||
// Using 'static_text' state (not 'hidden') so template renders values as static text
|
||||
$personalDataFields = [
|
||||
'firstName',
|
||||
@@ -77,12 +77,12 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
|
||||
];
|
||||
}
|
||||
|
||||
// Address fields - render as static text if authenticated user OR participant not mutable
|
||||
// Address fields - render as static text if first participant in non-internal agency OR participant not mutable
|
||||
$this->fieldStateConditions['address'] = [
|
||||
'static_text' => $personalDataHiddenCondition,
|
||||
];
|
||||
|
||||
// Address subfields - render as static text if authenticated user OR participant not mutable
|
||||
// Address subfields - render as static text if first participant in non-internal agency OR participant not mutable
|
||||
$this->fieldStateConditions['address.street'] = [
|
||||
'static_text' => $personalDataHiddenCondition,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user