fix: always fill-in empty participants names when submitting to api

This commit is contained in:
Björn Fromme
2026-02-20 09:48:22 +01:00
parent 21356f00d5
commit 45cfc459aa
2 changed files with 137 additions and 13 deletions
@@ -33,7 +33,7 @@ class PersonalDataSynchronizer
*
* @param array<ParticipantDto> $participants The participants array from the form
* @param Booking $bookingData The booking data object to update
* @param bool $isInternalAgencyBooking Whether to fill default names for canceled participants
* @param bool $isInternalAgencyBooking Whether to fill default names for participants with empty names
*/
public function updateParticipantPersonalData(
array $participants,
@@ -48,20 +48,18 @@ class PersonalDataSynchronizer
$bookingData->participants[$participant->index]->firstName = $participant->firstName;
$bookingData->participants[$participant->index]->name = $participant->lastName;
// For internal agency bookings, canceled participants with empty names get default values
// since they are read-only in the UI and cannot be fixed by applicants
// For internal agency bookings, participants with empty names get default values.
// Agencies pre-book slots with placeholder data (e.g. applicant surname, empty first name),
// and the BPN API rejects updates with empty name fields.
if ($isInternalAgencyBooking) {
$status = $bookingData->participantsStatus[$participant->index] ?? null;
if ('S' === $status) {
$defaultName = sprintf('Teilnehmer:in %d', $participant->index + 1);
$personalData = $bookingData->participants[$participant->index];
$defaultName = sprintf('Teilnehmer:in %d', $participant->index + 1);
$personalData = $bookingData->participants[$participant->index];
if (null === $personalData->firstName || '' === $personalData->firstName) {
$personalData->firstName = $defaultName;
}
if (null === $personalData->name || '' === $personalData->name) {
$personalData->name = $defaultName;
}
if (null === $personalData->firstName || '' === $personalData->firstName) {
$personalData->firstName = $defaultName;
}
if (null === $personalData->name || '' === $personalData->name) {
$personalData->name = $defaultName;
}
}