fix: properly handle 'veg' services in booking edit flow
This commit is contained in:
1 parent
287c299c41
commit
c0c8ad515c
9 files changed
+89
-4
No files matched your search
@@ -105,6 +105,9 @@ class BookingDataProcessor
|
||||
$participantData->board = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_BOARD);
|
||||
|
||||
$vegServices = $booking->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_VEG);
|
||||
$participantData->veg = false === empty($vegServices) ? reset($vegServices) : null;
|
||||
|
||||
$participantData->rentals = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_RENTALS);
|
||||
|
||||
@@ -211,6 +214,11 @@ class BookingDataProcessor
|
||||
}
|
||||
}
|
||||
|
||||
// Enrich veg
|
||||
if (null !== $participant->veg && isset($travel->additionalServices[$participant->veg->id])) {
|
||||
$participant->veg = $travel->additionalServices[$participant->veg->id];
|
||||
}
|
||||
|
||||
// Enrich rentals
|
||||
foreach ($participant->rentals as $key => $rental) {
|
||||
if (isset($travel->additionalServices[$rental->id])) {
|
||||
|
||||
@@ -171,8 +171,8 @@ class BookingPayloadBuilder
|
||||
'@idzimmer' => $room->id,
|
||||
'@kategorie' => $room->category,
|
||||
'@idverpflegung' => $room->boardId,
|
||||
'@anreise' => $room->dateFrom ? $room->dateFrom->format('d.m.Y') : null,
|
||||
'@abreise' => $room->dateTo ? $room->dateTo->format('d.m.Y') : null,
|
||||
'@anreise' => $room->dateFrom?->format('d.m.Y'),
|
||||
'@abreise' => $room->dateTo?->format('d.m.Y'),
|
||||
'@anzahl' => $room->totalCount,
|
||||
'@zuordnung' => implode(',', array_map(fn ($index) => $index + 1, $uniqueMapping)),
|
||||
];
|
||||
|
||||
@@ -131,6 +131,11 @@ class ParticipantServiceProcessor
|
||||
...$participant->rentals,
|
||||
];
|
||||
|
||||
// Veg is encoded as an additional service in the edit/update payload.
|
||||
if (null !== $participant->veg) {
|
||||
$services[] = $participant->veg;
|
||||
}
|
||||
|
||||
// Add ski pass if selected (single service, not an array)
|
||||
if (null !== $participant->skiPass) {
|
||||
$services[] = $participant->skiPass;
|
||||
|
||||
Reference in new issue
Block a user