From dba1fa79b0277cc36d4fe00621185298f04c0890 Mon Sep 17 00:00:00 2001 From: Alexander Elchlepp Date: Mon, 2 Sep 2024 09:27:01 +0200 Subject: [PATCH] close #88 bugfix add another and add new reservation is not working --- src/Controller/InvoiceServiceController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controller/InvoiceServiceController.php b/src/Controller/InvoiceServiceController.php index 94e201a..c623812 100644 --- a/src/Controller/InvoiceServiceController.php +++ b/src/Controller/InvoiceServiceController.php @@ -183,7 +183,7 @@ public function getReservationsInPeriodAction(ManagerRegistry $doctrine, Request { $em = $doctrine->getManager(); $reservations = []; - $newInvoiceInformationArray = $requestStack->getSession()->get('invoiceInCreation'); + $newInvoiceInformationArray = $requestStack->getSession()->get('invoiceInCreation', []); $potentialReservations = $em->getRepository( Reservation::class @@ -209,7 +209,6 @@ public function getReservationsForCustomerAction(ManagerRegistry $doctrine, Requ { $em = $doctrine->getManager(); $reservations = []; - $newInvoiceInformationArray = $requestStack->getSession()->get('invoiceInCreation'); $customer = $em->getRepository(Customer::class)->findOneByLastname( $request->request->get('lastname') @@ -220,7 +219,7 @@ public function getReservationsForCustomerAction(ManagerRegistry $doctrine, Requ Reservation::class )->loadReservationsWithoutInvoiceForCustomer($customer); - $newInvoiceInformationArray = $requestStack->getSession()->get('invoiceInCreation'); + $newInvoiceInformationArray = $requestStack->getSession()->get('invoiceInCreation', []); foreach ($potentialReservations as $reservation) { if (!in_array($reservation->getId(), $newInvoiceInformationArray)) { @@ -247,6 +246,7 @@ public function selectReservationAction(ManagerRegistry $doctrine, InvoiceServic } if (null != $request->request->get('reservationid')) { + $newInvoiceInformationArray = $requestStack->getSession()->get('invoiceInCreation', []); $newInvoiceInformationArray[] = $request->request->get('reservationid'); $requestStack->getSession()->set('invoiceInCreation', $newInvoiceInformationArray); }