diff --git a/src/Form/Service/Condition/PersonalDataMutabilityCondition.php b/src/Form/Service/Condition/PersonalDataMutabilityCondition.php index 8bd36e9..6f3cdfd 100644 --- a/src/Form/Service/Condition/PersonalDataMutabilityCondition.php +++ b/src/Form/Service/Condition/PersonalDataMutabilityCondition.php @@ -18,6 +18,10 @@ use App\Form\Service\Contract\FieldConditionInterface; * FirstParticipantReadOnlyCondition handles agency-based read-only logic for first participant, * while this condition applies BPN mutability rules to all participants. * + * Exception: For internal agency bookings (agency code 0004), the BPN mutability flag + * is ignored for all participants. Agency staff need full control over participant data + * regardless of BPN's mutability restrictions. + * * In edit mode, BPN determines mutability based on business rules (e.g., payment status, * booking state, etc.). We must respect this flag to prevent users from attempting to * modify data that BPN will reject. @@ -34,6 +38,9 @@ class PersonalDataMutabilityCondition implements FieldConditionInterface * that BPN does not allow modifications to this participant's data. * When true, personal data fields should be hidden and displayed as static text. * + * Exception: For internal agency bookings, always returns false to allow + * editing all participants regardless of BPN's mutability flag. + * * @param BookingDto $bookingDto The current booking data * @param int $participantIndex The index of the participant being evaluated * @param array $formData Current form data (unused) @@ -42,6 +49,12 @@ class PersonalDataMutabilityCondition implements FieldConditionInterface */ public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool { + // For internal agency bookings, all participants are editable + // regardless of BPN's mutability flag + if ($bookingDto->isInternalAgencyBooking()) { + return false; + } + $participant = $bookingDto->getParticipant($participantIndex); if (null === $participant) { return false;