diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php index 40b3115d..7df0541f 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php @@ -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; diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php index 91fca2d8..8c8087d3 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/AbstractRepository.php @@ -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) )); } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index ac826225..230f49c2 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -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; } /** diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_date.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_date.php index 761d008f..ee345446 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_date.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_date.php @@ -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', diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index 3689caee..79a2c806 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -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,