feat: fill default names for canceled participants in agency bookings
This commit is contained in:
@@ -290,7 +290,11 @@ class BookingDataProcessor
|
||||
}
|
||||
|
||||
$this->serviceProcessor->removeUnusedServices($bookingData);
|
||||
$this->personalDataSynchronizer->updateParticipantPersonalData($formData->participants, $bookingData);
|
||||
$this->personalDataSynchronizer->updateParticipantPersonalData(
|
||||
$formData->participants,
|
||||
$bookingData,
|
||||
$formData->isInternalAgencyBooking()
|
||||
);
|
||||
|
||||
$payload = $this->payloadBuilder->buildBasePayload($bookingData);
|
||||
$this->payloadBuilder->addBankAccountToPayload($payload, $bookingData);
|
||||
|
||||
@@ -33,9 +33,13 @@ 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
|
||||
*/
|
||||
public function updateParticipantPersonalData(array $participants, Booking $bookingData): void
|
||||
{
|
||||
public function updateParticipantPersonalData(
|
||||
array $participants,
|
||||
Booking $bookingData,
|
||||
bool $isInternalAgencyBooking = false
|
||||
): void {
|
||||
// Fill missing mandatory fields on applicant (for company bookings by travel agencies)
|
||||
// This is separate from participants - applicant may be a company while participants are real people
|
||||
$this->fillMissingApplicantFields($bookingData);
|
||||
@@ -43,6 +47,24 @@ class PersonalDataSynchronizer
|
||||
foreach ($participants as $participant) {
|
||||
$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
|
||||
if ($isInternalAgencyBooking) {
|
||||
$status = $bookingData->participantsStatus[$participant->index] ?? null;
|
||||
if ('S' === $status) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bookingData->participants[$participant->index]->dateOfBirth = $participant->dateOfBirth;
|
||||
$bookingData->participants[$participant->index]->gender = $participant->gender;
|
||||
$bookingData->participants[$participant->index]->nationality = $participant->nationality;
|
||||
|
||||
Reference in New Issue
Block a user