fix: ensure correct sorting of rooms in pricetables
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user