feat: improved mutability checks for personal data in edit or create mode

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent ff39bf365c
commit 43823dbda1
27 changed files with 435 additions and 233 deletions
@@ -490,6 +490,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
'multiple' => false,
'expanded' => true,
'required' => false,
'placeholder' => false, // Disable default placeholder - synthetic "keine Versicherung gewünscht" option injected instead
'choices' => $this->getEligibleInsurances($bookingDto, $participantIndex),
'choice_value' => 'id',
'choice_label' => function (?Insurance $insurance) {
@@ -501,7 +502,6 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
return $label;
},
'placeholder' => 'Keine Versicherung gewünscht',
];
// Future field providers would be added here, for example:
@@ -799,6 +799,9 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
/**
* Gets eligible insurances for a participant based on eligibility criteria.
*
* Injects a synthetic "keine Versicherung gewünscht" option at the top of the list
* to force explicit user choice for legal compliance.
*
* @param BookingDto $bookingDto The booking DTO containing travel and participant data
* @param int $participantIndex The index of the participant to get eligible insurances for
*
@@ -818,12 +821,24 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
$travelPrice = $this->priceCalculatorService->calculateIndividualParticipantPriceExcludingInsurance($bookingDto, $participantIndex);
// Filter based on eligibility criteria for this participant
return $this->insuranceService->getEligibleInsurances(
$eligibleInsurances = $this->insuranceService->getEligibleInsurances(
$selectableInsurances,
$participant,
$bookingDto,
$travelPrice
);
// Inject synthetic "no insurance" option at the top of the list
// This forces explicit user choice for legal compliance
$noInsurance = new Insurance();
$noInsurance->id = Insurance::NO_INSURANCE_ID;
$noInsurance->label = 'keine Versicherung gewünscht';
$noInsurance->price = 0.0;
// Prepend to list (appears first in radio buttons)
array_unshift($eligibleInsurances, $noInsurance);
return $eligibleInsurances;
}
/**