diff --git a/src/BusProNet/Constants.php b/src/BusProNet/Constants.php index 022556c..f415cb9 100644 --- a/src/BusProNet/Constants.php +++ b/src/BusProNet/Constants.php @@ -47,4 +47,8 @@ final class Constants public const STATUS_AVAILABLE = 'Frei'; public const STATUS_BLOCKED = 'Buchungsstop'; public const STATUS_ON_REQUEST = 'Anfrage'; + + // Payment methods + public const PAYMENT_METHOD_TRANSFER = 'transfer'; + public const PAYMENT_METHOD_DEBIT = 'debit'; } diff --git a/src/Form/BookingParticipantType.php b/src/Form/BookingParticipantType.php index a90a90f..790e421 100644 --- a/src/Form/BookingParticipantType.php +++ b/src/Form/BookingParticipantType.php @@ -176,26 +176,7 @@ class BookingParticipantType extends AbstractType */ private function removeExcludedFields(FormInterface $form, BookingDtoInterface $bookingDto, int $participantIndex, array $formData = []): void { - $dynamicFields = [ - 'assignedRoomId', - 'remarksRoom', - 'courses', - 'additionalServices', - 'board', - 'rentals', - 'rentalInsurance', - 'skiPass', - 'transportationOutbound', - 'transportationInbound', - 'pickupOutbound', - 'pickupInbound', - 'parking', - 'licensePlate', - 'bulkInsuranceBooking', - 'insurance', - ]; - - foreach ($dynamicFields as $fieldName) { + foreach (ParticipantDto::DYNAMIC_FIELDS as $fieldName) { if ($form->has($fieldName) && !$this->fieldStateProvider->shouldIncludeField($fieldName, $bookingDto, $participantIndex, $formData)) { $form->remove($fieldName); } @@ -224,12 +205,7 @@ class BookingParticipantType extends AbstractType $this->addBaseFields($form, $bookingDto, $participantIndex); // Rebuild dynamic fields - $dynamicFields = [ - 'assignedRoomId', 'remarksRoom', 'courses', 'additionalServices', 'board', 'rentals', 'rentalInsurance', - 'skiPass', 'transportationOutbound', 'transportationInbound', 'pickupOutbound', 'pickupInbound', 'parking', - 'licensePlate', 'bulkInsuranceBooking', 'insurance', - ]; - foreach ($dynamicFields as $fieldName) { + foreach (ParticipantDto::DYNAMIC_FIELDS as $fieldName) { if ($form->has($fieldName)) { $form->remove($fieldName); } diff --git a/src/Form/Service/ParticipantFieldHandlerRegistry.php b/src/Form/Service/ParticipantFieldHandlerRegistry.php index 1935aec..a26b136 100644 --- a/src/Form/Service/ParticipantFieldHandlerRegistry.php +++ b/src/Form/Service/ParticipantFieldHandlerRegistry.php @@ -294,7 +294,9 @@ class ParticipantFieldHandlerRegistry { // Sync fields for all registered handlers foreach ($this->handlers as $fieldName => $handler) { - if (property_exists($participant, $fieldName)) { + // Only sync fields that were in the original submission + // This prevents adding extra fields that would cause validation errors + if (property_exists($participant, $fieldName) && array_key_exists($fieldName, $participantData)) { $dtoValue = $participant->{$fieldName}; $participantData[$fieldName] = $this->convertDtoValueToSubmittedFormat($dtoValue); }