Skip to content

Commit

Permalink
close #88 bugfix add another and add new reservation is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
developeregrem committed Sep 2, 2024
1 parent 415fa19 commit dba1fa7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Controller/InvoiceServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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)) {
Expand All @@ -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);
}
Expand Down

0 comments on commit dba1fa7

Please sign in to comment.