fix: show pickup select field for outbound bus travel only

This commit is contained in:
Björn Fromme
2026-03-16 12:03:00 +01:00
parent f795a3ea21
commit f99a2d99a2
3 changed files with 10 additions and 22 deletions
@@ -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;
}