From 08aaff1e2d3c970fd65c575bc0492a2a401dc4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 19 Feb 2026 08:22:52 +0100 Subject: [PATCH] fix: show pickup select field for outbound bus travel only --- src/Form/Service/CreateFieldStateProvider.php | 7 ++----- src/Form/Service/EditFieldStateProvider.php | 7 ++----- .../Service/ParticipantPickupFieldHandler.php | 18 ++++++------------ 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/Form/Service/CreateFieldStateProvider.php b/src/Form/Service/CreateFieldStateProvider.php index 6095193..93bbdd8 100644 --- a/src/Form/Service/CreateFieldStateProvider.php +++ b/src/Form/Service/CreateFieldStateProvider.php @@ -250,13 +250,10 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider ), ]; - // Show pickup only when either outbound or inbound transportation is BUS (hidden by default) + // Pickup field - shown only when outbound transportation is BUS (pickup is for outbound journey) $this->fieldStateConditions['pickup'] = [ 'hidden' => CompositeCondition::not( - CompositeCondition::or( - ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API), - ServiceSubTypeCondition::equals('transportationInbound', DirectionMapper::SUBTYPE_BUS_API) - ) + ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API) ), ]; diff --git a/src/Form/Service/EditFieldStateProvider.php b/src/Form/Service/EditFieldStateProvider.php index 385be70..1001b6b 100644 --- a/src/Form/Service/EditFieldStateProvider.php +++ b/src/Form/Service/EditFieldStateProvider.php @@ -186,13 +186,10 @@ class EditFieldStateProvider extends AbstractFieldStateProvider 'readonly' => $transportationServicesMutabilityCondition, ]; - // Pickup field (unified) - shown only when either transportation direction is BUS, readonly if pickups not mutable + // Pickup field - shown only when outbound transportation is BUS (pickup is for outbound journey), readonly if pickups not mutable $this->fieldStateConditions['pickup'] = [ 'hidden' => CompositeCondition::not( - CompositeCondition::or( - ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API), - ServiceSubTypeCondition::equals('transportationInbound', DirectionMapper::SUBTYPE_BUS_API) - ) + ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API) ), 'readonly' => $pickupsMutabilityCondition, ]; diff --git a/src/Form/Service/ParticipantPickupFieldHandler.php b/src/Form/Service/ParticipantPickupFieldHandler.php index 865ff10..af92fff 100644 --- a/src/Form/Service/ParticipantPickupFieldHandler.php +++ b/src/Form/Service/ParticipantPickupFieldHandler.php @@ -9,13 +9,10 @@ use App\Form\Model\BookingDto; use App\Form\Service\Abstract\AbstractParticipantFieldHandler; /** - * Handles unified pickup location selection. + * Handles pickup location selection for the outbound bus journey. * - * Pickup selection is only processed when either outbound or inbound - * transportation is bus type. Automatically clears pickup when both - * transportation services change to self-organized (PKW). - * - * The pickup applies to both directions and uses the outbound pickup list. + * Pickup is only processed when outbound transportation is bus type. + * Automatically clears pickup when outbound changes to self-organized (PKW). */ class ParticipantPickupFieldHandler extends AbstractParticipantFieldHandler { @@ -41,15 +38,12 @@ class ParticipantPickupFieldHandler extends AbstractParticipantFieldHandler return; } - // Check if either outbound or inbound transportation is bus + // Pickup applies only to outbound bus journey - clear when outbound is not bus $hasOutboundBus = null !== $participant->transportationOutbound && DirectionMapper::SUBTYPE_BUS_API === $participant->transportationOutbound->subType; - $hasInboundBus = null !== $participant->transportationInbound - && DirectionMapper::SUBTYPE_BUS_API === $participant->transportationInbound->subType; - // Only process pickup if at least one direction has bus transport - if (false === $hasOutboundBus && false === $hasInboundBus) { - $participant->pickup = null; // Clear pickup for non-bus transport + if (false === $hasOutboundBus) { + $participant->pickup = null; return; }