Skip to content

Commit

Permalink
Merge pull request #89 from developeregrem/3.6.1-dev
Browse files Browse the repository at this point in the history
3.6.1 dev
  • Loading branch information
developeregrem authored Sep 2, 2024
2 parents ab4ff88 + dba1fa7 commit 266fcdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 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
3 changes: 2 additions & 1 deletion src/Service/ReservationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use App\Entity\Reservation;
use App\Entity\ReservationStatus;
use App\Entity\Template;
use App\Entity\CustomerAddresses;
use App\Interfaces\ITemplateRenderer;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
Expand Down Expand Up @@ -368,7 +369,7 @@ public function getRenderParams(Template $template, mixed $param)
// params need to be an array containing a list of Reservation Objects
$params = [
'reservation1' => $param[0],
'address' => (0 == count($param[0]->getBooker()->getCustomerAddresses()) ? null : $param[0]->getBooker()->getCustomerAddresses()[0]),
'address' => (0 == count($param[0]->getBooker()->getCustomerAddresses()) ? new CustomerAddresses() : $param[0]->getBooker()->getCustomerAddresses()[0]),
'reservations' => $param,
];
$prices = $this->getTotalPricesForTemplate($param);
Expand Down

0 comments on commit 266fcdd

Please sign in to comment.