fix: preserve selected services from booking even when unavailable

When editing a booking, services that were previously booked but are no
longer available in the travel catalog were being dropped. This caused
API error 650 ("Anzahl Leistung stimmt nicht mit Teilnehmerzuordnung
überein") because the service participant counts no longer matched.

The fix ensures that in edit mode, booked services are merged with
travel data services in both:
- Form rendering (ParticipantFieldOptionsProvider): so checkboxes appear
- Handler validation (AbstractParticipantFieldHandler): so selections
  are accepted

This allows users to keep their existing service selections or
deliberately replace them with other available options. Create mode
remains unchanged.
This commit is contained in:
Björn Fromme
2026-03-16 12:02:28 +01:00
parent 029a87c6ca
commit 957e20d763
16 changed files with 204 additions and 37 deletions
@@ -58,7 +58,13 @@ class ParticipantBoardFieldHandler extends AbstractParticipantFieldHandler
}
$selectedBoard = $this->getFieldValue($submittedData, $this->getFieldName()) ?? [];
$availableBoard = $bookingDto->travel->getAdditionalServicesBySubTypes(Constants::TOKEN_BOARD);
// Get available board options from travel data (includes booked options in edit mode)
$availableBoard = $this->getAvailableServicesWithBooked(
$bookingDto,
$participantIndex,
Constants::TOKEN_BOARD
);
$validSelections = $this->filterValidServiceSelections(
$selectedBoard,