From 0c910c4713449c1c0b261572e6aae7b0f9205c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 29 May 2024 11:05:29 +0200 Subject: [PATCH] fix: ensure correct sorting of rooms in pricetables --- .../Classes/Domain/Repository/ProductRepository.php | 10 ++++++---- .../ext/ep_products/Classes/Service/DateService.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php index 939ef1fa..054c7ffc 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php @@ -187,7 +187,7 @@ class ProductRepository extends AbstractRepository ; } - public function getPricetable(Product $product, Hotel $hotel, array $filterSettings, Date $date = null, bool $sortByRoom = false): array + public function getPricetable(Product $product, Hotel $hotel, array $filterSettings, Date $date = null, bool $sortByRoom = true): array { $qb = $this->getDbConnection()->createQueryBuilder(); @@ -207,12 +207,14 @@ class ProductRepository extends AbstractRepository if (true === $sortByRoom) { $qb->addOrderBy('room.name', 'ASC'); + } else { + $qb + ->addOrderBy('room.pax', 'ASC') + ->addOrderBy('room.price', 'ASC') + ; } $qb - ->addOrderBy('date.date_start', 'ASC') - ->addOrderBy('room.pax', 'ASC') - ->addOrderBy('room.price', 'ASC') ->where('date.date_start >= NOW()') ->andWhere($qb->expr()->eq( 'date.product', diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php index f9ccfe65..c3ad5889 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateService.php @@ -134,7 +134,7 @@ class DateService implements SingletonInterface $resolver->setDefaults([ 'template' => 'base', 'date' => null, - 'sortByRoom' => false, + 'sortByRoom' => true, ]); $resolver->setAllowedTypes('product', Product::class); $resolver->setAllowedTypes('hotel', Hotel::class);