feat: duplicate an accommodation booking into a new draft

addresses #869f6z44f
This commit is contained in:
fromme committed 2026-09-28 08:55:01 +02:00
1 parent 2aa98b81fe
commit 29f295abf6
9 files changed
+470

No files matched your search

@@ -576,6 +576,33 @@ class AccommodationBookingService
* @throws ImplausibleBookingPriceException if the new house prices the stay implausibly high;
* the booking is left at its old house
*/
/**
* Copies a booking into a fresh Entwurf, so the office can build a variation of an offer
* instead of keying the whole thing in again. Everything the customer was quoted comes
* along verbatim — house, dates, pax, the board and additional service snapshots, the
* discounts and the stored price breakdown — while AccommodationBooking::__clone() resets
* the identity and the lifecycle.
*
* Allowed from any status, including Bestätigt and Absage: nothing on the original is
* touched, and "same group, next season" is exactly the case this exists for. The price is
* deliberately not recomputed, see __clone().
*/
public function duplicate(AccommodationBooking $booking): AccommodationBooking
{
$copy = clone $booking;
// Marks the copy where the office looks for it — the list is sorted and scanned by
// group name, and two identical rows are otherwise impossible to tell apart.
if (null !== $copy->getGroupName()) {
$copy->setGroupName($copy->getGroupName().' (Kopie)');
}
$this->entityManager->persist($copy);
$this->entityManager->flush();
return $copy;
}
public function changeAccommodation(AccommodationBooking $booking, Accommodation $accommodation): void
{
if (!$booking->isDraft() || $booking->getAccommodation() === $accommodation) {