wip: incorrect rules around family insurances

addresses #869dr80qj
This commit is contained in:
Björn Fromme committed 2026-08-05 13:47:49 +02:00
1 parent 736128476b
commit 36955a1e98
15 files changed
+859 -50

No files matched your search

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App\Form\Service\Condition;
use App\Form\Model\BookingDto;
use App\Form\Service\Contract\FieldConditionInterface;
/**
* True for dependent participants when the applicant has a family insurance selected.
*
* Family insurance covers the whole family under a single policy on the applicant, so
* dependents must not be offered their own insurance selection while it's active.
*/
class FamilyInsuranceActiveCondition implements FieldConditionInterface
{
public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool
{
if (0 === $participantIndex) {
return false;
}
$applicant = $bookingDto->getParticipant(0);
return null !== $applicant
&& null !== $applicant->insurance
&& true === $applicant->insurance->familyInsurance;
}
public function getDependentFields(): array
{
return ['insurance'];
}
public function getDescription(): string
{
return 'Applicant has a family insurance selected';
}
}