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