feat: apply pax filter to min pax attribute of a room

This commit is contained in:
Björn Fromme
2025-01-07 10:34:49 +01:00
parent 9f857c0257
commit 403c53d1e0
5 changed files with 38 additions and 2 deletions
@@ -164,6 +164,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $available = 0;
/**
* @var int
*/
protected $minPax = 0;
/**
* @var bool
*/
@@ -589,6 +594,18 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->available = $available;
}
public function getMinPax()
{
return $this->minPax;
}
public function setMinPax($minPax)
{
$this->minPax = $minPax;
return $this;
}
public function isNew()
{
return $this->new;
@@ -139,7 +139,7 @@ abstract class AbstractRepository extends Repository
// Pax
if ($filterSettings['pax'] > 0) {
$qb->andWhere($qb->expr()->gte(
'date.available',
'date.min_pax',
$qb->createNamedParameter($filterSettings['pax'], Connection::PARAM_INT)
));
}
@@ -578,6 +578,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
{
$minPriceOverall = 0;
$minPriceAvailable = 0;
$minPax = 0;
$availableTotal = 0;
$boardCode = '';
$count = 0;
@@ -607,6 +608,11 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
continue;
}
$pax = (int) $roomXml->attributes()['MinPax'];
if (0 === $minPax || $pax < $minPax) {
$minPax = $pax;
}
$pax = (int) $roomXml->attributes()['MaxPax'];
$availableTotal += $available * $pax;
@@ -658,6 +664,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
$date['min_price'] = $minPriceAvailable ?: $minPriceOverall;
$date['available'] = $availableTotal;
$date['rooms'] = $count;
$date['min_pax'] = $minPax;
}
/**
@@ -25,7 +25,9 @@ return [
'types' => [
'1' => ['showitem' => 'hidden, bus_pro_id, hotel_bus_pro_id, code, daytrip, date_start, date_end, nights, board,
board_code, board_bus_pro_id, bus_included, bus_available, skipass_included, services_included,
services_general, courses_included, guide, pickups, discount, min_price, pseudo_price, available, new'],
services_general, courses_included, guide, pickups, discount, min_price, pseudo_price, available, min_pax,
new'
],
],
'palettes' => [
'1' => ['showitem' => ''],
@@ -362,6 +364,15 @@ return [
'eval' => 'trim',
],
],
'min_pax' => [
'exclude' => false,
'label' => 'Min. Pax',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim',
],
],
'new' => [
'exclude' => false,
'label' => 'neu',
@@ -126,6 +126,7 @@ CREATE TABLE tx_epproducts_domain_model_date
min_price int(11) DEFAULT '0' NOT NULL,
pseudo_price int(11) DEFAULT '0' NOT NULL,
available int(11) DEFAULT '0' NOT NULL,
min_pax int(11) DEFAULT '0' NOT NULL,
product int(11) unsigned DEFAULT '0',
product_pid int(11) unsigned DEFAULT '0',
daytrip tinyint(1) unsigned DEFAULT '0' NOT NULL,