fix: process canceled participants correctly
This commit is contained in:
1 parent
c76eb12727
commit
6a4ac4ea43
10 files changed
+178
-184
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class Booking
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getPickupToForParticipant(int $participantIndex): ?Pickup
|
||||
public function getPickupForParticipant(int $participantIndex): ?Pickup
|
||||
{
|
||||
foreach ($this->pickupsTo as $pickup) {
|
||||
if (in_array($participantIndex, $pickup->mapping)) {
|
||||
@@ -87,17 +87,6 @@ class Booking
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getPickupFroForParticipant(int $participantIndex): ?Pickup
|
||||
{
|
||||
foreach ($this->pickupsFro as $pickup) {
|
||||
if (in_array($participantIndex, $pickup->mapping)) {
|
||||
return $pickup;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getRoomForParticipant(int $participantIndex): ?Room
|
||||
{
|
||||
foreach ($this->rooms as $room) {
|
||||
|
||||
@@ -9,6 +9,7 @@ class PersonalData
|
||||
public ?int $addressId = null;
|
||||
public ?int $personId = null;
|
||||
public bool $mutable = false;
|
||||
public ?string $status = null;
|
||||
|
||||
#[Assert\NotBlank(message: 'Bitte angeben')]
|
||||
public ?string $name = null;
|
||||
@@ -57,4 +58,4 @@ class PersonalData
|
||||
'bemerkung' => $this->remarks,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ trait TypeConversionTrait
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'True' === $string;
|
||||
return 'True' === $string || 'J' === $string;
|
||||
}
|
||||
|
||||
protected function boolToString(bool $bool): string
|
||||
@@ -71,4 +71,4 @@ trait TypeConversionTrait
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,8 @@ class BookingParser extends AbstractParser
|
||||
{
|
||||
$personalData = new PersonalData();
|
||||
|
||||
$personalData->status = $this->getStringOrNullValue($node->filterXPath('//status'));
|
||||
|
||||
$personalData->addressId = $this->getIntOrNullValue($node->filterXPath('//idadresse'));
|
||||
$personalData->personId = $this->getIntOrNullValue($node->filterXPath('//idadresseperson'));
|
||||
$personalData->mutable = $this->getBoolValue($node->filterXPath('//aenderungmoeglich'));
|
||||
|
||||
Reference in new issue
Block a user