wip: finalize implementation
This commit is contained in:
@@ -76,7 +76,7 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
/**
|
||||
* Determines if this handler should process the field based on submitted data.
|
||||
*
|
||||
* Insurance handler should NOT process in edit mode because the BPN API does not
|
||||
* Insurance handler should NOT procefss in edit mode because the BPN API does not
|
||||
* return insurance data. In edit mode, insurance data must be preserved as-is
|
||||
* and passed through to the update endpoint unchanged.
|
||||
*
|
||||
@@ -172,8 +172,6 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
// Insurance not found - clear selection
|
||||
$participant->insurance = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle form resubmission with existing insurance (automatic reassignment check)
|
||||
@@ -241,15 +239,15 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
/**
|
||||
* Finds an insurance by ID from the available insurances array.
|
||||
*
|
||||
* @param array<Insurance> $insurances Array of available insurances
|
||||
* @param string|int $insuranceId The insurance ID to find
|
||||
* @param array<Insurance> $insurances Array of available insurances
|
||||
* @param string $insuranceId The insurance ID to find
|
||||
*
|
||||
* @return Insurance|null The found insurance or null if not found
|
||||
*/
|
||||
private function findInsuranceById(array $insurances, string|int $insuranceId): ?Insurance
|
||||
private function findInsuranceById(array $insurances, string $insuranceId): ?Insurance
|
||||
{
|
||||
foreach ($insurances as $insurance) {
|
||||
if ($insurance->id === $insuranceId || (string) $insurance->id === (string) $insuranceId) {
|
||||
if ($insurance->id === $insuranceId) {
|
||||
return $insurance;
|
||||
}
|
||||
}
|
||||
@@ -268,7 +266,7 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
private function isInsuranceInList(Insurance $targetInsurance, array $insuranceList): bool
|
||||
{
|
||||
foreach ($insuranceList as $insurance) {
|
||||
if ($insurance->id === $targetInsurance->id || (string) $insurance->id === (string) $targetInsurance->id) {
|
||||
if ($insurance->id === $targetInsurance->id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -282,14 +280,14 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
* This is used to distinguish between a new user selection and a form resubmission
|
||||
* with the existing insurance selection (e.g., when user adds rentals that change travel price).
|
||||
*
|
||||
* @param string|int $selectedInsuranceId The insurance ID from form submission
|
||||
* @param string $selectedInsuranceId The insurance ID from form submission
|
||||
* @param Insurance $currentInsurance The currently assigned insurance from DTO
|
||||
*
|
||||
* @return bool True if they represent the same insurance
|
||||
*/
|
||||
private function isSameInsurance(string|int $selectedInsuranceId, Insurance $currentInsurance): bool
|
||||
private function isSameInsurance(string $selectedInsuranceId, Insurance $currentInsurance): bool
|
||||
{
|
||||
return (string) $currentInsurance->id === (string) $selectedInsuranceId;
|
||||
return $currentInsurance->id === $selectedInsuranceId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user