feat: edit selected accommodation of bookings in draft
This commit is contained in:
@@ -530,6 +530,35 @@ class AccommodationBookingService
|
||||
$this->sendCustomerConfirmationEmail($booking);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a draft to another Gruppenhaus, for the case where the wrong one was picked at
|
||||
* creation. The chosen Verpflegung and Zusatzleistungen belong to the old house's catalog —
|
||||
* they carry its prices and its ids — so they are dropped rather than guessed at; the office
|
||||
* picks them again from the new catalog on the edit page.
|
||||
* Restricted to Entwurf: anything further along may already be in front of the customer via
|
||||
* their access link, and swapping the house underneath them would rewrite what they were
|
||||
* offered.
|
||||
* Idempotent — a no-op for a booking that is not a draft or already sits at $accommodation.
|
||||
*/
|
||||
public function changeAccommodation(AccommodationBooking $booking, Accommodation $accommodation): void
|
||||
{
|
||||
if (!$booking->isDraft() || $booking->getAccommodation() === $accommodation) {
|
||||
return;
|
||||
}
|
||||
|
||||
$booking->setAccommodation($accommodation);
|
||||
|
||||
$booking->setBoardServiceLabel(null);
|
||||
$booking->setBoardServicePrice(null);
|
||||
$booking->setBoardServiceOriginalId(null);
|
||||
$booking->setAdditionalServices([]);
|
||||
|
||||
// Clears the snapshot by itself when the new house has no price for the booked range.
|
||||
$this->refreshPriceSnapshot($booking);
|
||||
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a booking that is not going to happen. Deliberately silent: the office tells
|
||||
* the customer itself, so this only records the outcome.
|
||||
|
||||
Reference in New Issue
Block a user