fix: process canceled participants correctly
This commit is contained in:
@@ -17,6 +17,11 @@ class BookingDataProcessor
|
||||
}
|
||||
// Update mappings, add services and pickups
|
||||
foreach ($formData->participants as $participant) {
|
||||
// skip canceled participants
|
||||
if ('F' !== $participant->status) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$servicesToMap = [
|
||||
...$participant->courses,
|
||||
...$participant->additionalServices,
|
||||
@@ -46,12 +51,6 @@ class BookingDataProcessor
|
||||
}
|
||||
$bookingData->pickupsTo[$selectedPickup->id]->mapping[] = $participant->index;
|
||||
}
|
||||
if ('BUS' === $participant->transportationServiceFro->subType && null !== $selectedPickup = $participant->pickupFro) {
|
||||
if (false === isset($bookingData->pickupsFro[$selectedPickup->id])) {
|
||||
$bookingData->pickupsFro[$selectedPickup->id] = $selectedPickup;
|
||||
}
|
||||
$bookingData->pickupsFro[$selectedPickup->id]->mapping[] = $participant->index;
|
||||
}
|
||||
}
|
||||
// Remove services/pickups with empty mappings
|
||||
foreach ($bookingData->additionalServices as $service) {
|
||||
@@ -77,8 +76,12 @@ class BookingDataProcessor
|
||||
|
||||
// Update participants' personal data
|
||||
foreach ($formData->participants as $participant) {
|
||||
// skip canceled participants
|
||||
if ('F' !== $participant->status) {
|
||||
continue;
|
||||
}
|
||||
$bookingData->participants[$participant->index]->firstName = $participant->firstName;
|
||||
$bookingData->participants[$participant->index]->lastName = $participant->lastName;
|
||||
$bookingData->participants[$participant->index]->name = $participant->lastName;
|
||||
$bookingData->participants[$participant->index]->dateOfBirth = $participant->dateOfBirth;
|
||||
$bookingData->participants[$participant->index]->gender = $participant->gender;
|
||||
$bookingData->participants[$participant->index]->nationality = $participant->nationality;
|
||||
@@ -169,17 +172,6 @@ class BookingDataProcessor
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < count($bookingData->pickupsFro)) {
|
||||
$payload['zustiege_rueck']['zustieg_rueck'] = [];
|
||||
foreach ($bookingData->pickupsFro as $pickup) {
|
||||
$payload['zustiege_rueck']['zustieg_rueck'][] = [
|
||||
'@idzustieg' => $pickup->id,
|
||||
'@anzahl' => count($pickup->mapping),
|
||||
'@zuordnung' => implode(',', $pickup->mapping),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $payload;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user