fix: correct room assignment and count
closes #869c2jnzr
This commit is contained in:
@@ -172,7 +172,7 @@ class BookingPayloadBuilder
|
||||
'@idverpflegung' => $room->boardId,
|
||||
'@anreise' => $room->dateFrom ? $room->dateFrom->format('d.m.Y') : null,
|
||||
'@abreise' => $room->dateTo ? $room->dateTo->format('d.m.Y') : null,
|
||||
'@anzahl' => count($uniqueMapping),
|
||||
'@anzahl' => $room->totalCount,
|
||||
'@zuordnung' => implode(',', array_map(fn ($index) => $index + 1, $uniqueMapping)),
|
||||
];
|
||||
}
|
||||
@@ -456,12 +456,21 @@ class BookingPayloadBuilder
|
||||
$availableRooms = $bookingDto->travel->getAvailableRooms();
|
||||
$payload['ferienzielunterbringungen']['ferienzielunterbringung'] = [];
|
||||
|
||||
// Build room selection quantity lookup
|
||||
$roomQuantities = [];
|
||||
foreach ($bookingDto->roomSelections as $selection) {
|
||||
if ($selection->quantity > 0) {
|
||||
$roomQuantities[$selection->id] = $selection->quantity;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($roomMap as $roomId => $participantIds) {
|
||||
$room = $availableRooms[$roomId] ?? null;
|
||||
if (null === $room) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$quantity = $roomQuantities[$roomId] ?? 1;
|
||||
$uniqueParticipantIds = array_unique($participantIds);
|
||||
|
||||
$payload['ferienzielunterbringungen']['ferienzielunterbringung'][] = [
|
||||
@@ -470,7 +479,7 @@ class BookingPayloadBuilder
|
||||
'@idverpflegung' => $room->boardId,
|
||||
'@anreise' => $bookingDto->travel->dateFrom->format('d.m.Y'),
|
||||
'@abreise' => $bookingDto->travel->dateTo->format('d.m.Y'),
|
||||
'@anzahl' => count($uniqueParticipantIds),
|
||||
'@anzahl' => $quantity,
|
||||
'@zuordnung' => implode(',', $uniqueParticipantIds),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user