From ba18a1c5a81c1831c696677b4f729041ba2e0706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Fri, 10 Jan 2020 13:46:02 +0100 Subject: [PATCH 1/4] Implement model and TCA --- .../Classes/Domain/Model/GroupsPriceBoard.php | 75 ++++++ .../Domain/Model/GroupsPriceConfig.php | 138 +++++++++++ .../Domain/Model/GroupsPriceOption.php | 75 ++++++ .../Classes/Domain/Model/Hotel.php | 217 ++++++++++++------ .../Classes/Service/LabelService.php | 9 + ...oducts_domain_model_groups_price_board.php | 149 ++++++++++++ ...ducts_domain_model_groups_price_config.php | 176 ++++++++++++++ ...ducts_domain_model_groups_price_option.php | 149 ++++++++++++ .../TCA/tx_epproducts_domain_model_hotel.php | 72 +++++- .../typo3conf/ext/ep_products/ext_tables.sql | 134 +++++++++++ 10 files changed, 1117 insertions(+), 77 deletions(-) create mode 100644 public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php create mode 100644 public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php create mode 100644 public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php create mode 100644 public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php create mode 100644 public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php create mode 100644 public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php new file mode 100644 index 00000000..7932cace --- /dev/null +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php @@ -0,0 +1,75 @@ +, dreipunktnull + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +class GroupsPriceBoard extends AbstractEntity +{ + /** + * @var string + */ + protected $title; + + /** + * @var float + */ + protected $price; + + /** + * @return string + */ + public function getTitle(): string + { + return $this->title; + } + + /** + * @param string $title + */ + public function setTitle(string $title): void + { + $this->title = $title; + } + + /** + * @return float + */ + public function getPrice(): float + { + return $this->price; + } + + /** + * @param float $price + */ + public function setPrice(float $price): void + { + $this->price = $price; + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php new file mode 100644 index 00000000..8713cd45 --- /dev/null +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php @@ -0,0 +1,138 @@ +, dreipunktnull + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +class GroupsPriceConfig extends AbstractEntity +{ + /** + * @var \DateTime + */ + protected $dateFrom; + + /** + * @var \DateTime + */ + protected $dateTo; + + /** + * @var int + */ + protected $personsIncluded; + + /** + * @var float + */ + protected $price; + + /** + * @var float + */ + protected $priceAdditionalPerson; + + /** + * @return \DateTime + */ + public function getDateFrom(): \DateTime + { + return $this->dateFrom; + } + + /** + * @param \DateTime $dateFrom + */ + public function setDateFrom(\DateTime $dateFrom): void + { + $this->dateFrom = $dateFrom; + } + + /** + * @return \DateTime + */ + public function getDateTo(): \DateTime + { + return $this->dateTo; + } + + /** + * @param \DateTime $dateTo + */ + public function setDateTo(\DateTime $dateTo): void + { + $this->dateTo = $dateTo; + } + + /** + * @return int + */ + public function getPersonsIncluded(): int + { + return $this->personsIncluded; + } + + /** + * @param int $personsIncluded + */ + public function setPersonsIncluded(int $personsIncluded): void + { + $this->personsIncluded = $personsIncluded; + } + + /** + * @return float + */ + public function getPrice(): float + { + return $this->price; + } + + /** + * @param float $price + */ + public function setPrice(float $price): void + { + $this->price = $price; + } + + /** + * @return float + */ + public function getPriceAdditionalPerson(): float + { + return $this->priceAdditionalPerson; + } + + /** + * @param float $priceAdditionalPerson + */ + public function setPriceAdditionalPerson(float $priceAdditionalPerson): void + { + $this->priceAdditionalPerson = $priceAdditionalPerson; + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php new file mode 100644 index 00000000..4fa0111d --- /dev/null +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php @@ -0,0 +1,75 @@ +, dreipunktnull + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +class GroupsPriceOption extends AbstractEntity +{ + /** + * @var string + */ + protected $title; + + /** + * @var float + */ + protected $price; + + /** + * @return string + */ + public function getTitle(): string + { + return $this->title; + } + + /** + * @param string $title + */ + public function setTitle(string $title): void + { + $this->title = $title; + } + + /** + * @return float + */ + public function getPrice(): float + { + return $this->price; + } + + /** + * @param float $price + */ + public function setPrice(float $price): void + { + $this->price = $price; + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php index 64e0dd8e..9e73e522 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php @@ -27,7 +27,10 @@ namespace EP\EpProducts\Domain\Model; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements TeaserInterface +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + +class Hotel extends AbstractEntity implements TeaserInterface { const CATEGORY_STANDARD = 1; @@ -166,22 +169,22 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te protected $address = ''; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> + * @var ObjectStorage */ protected $images; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> + * @var ObjectStorage */ protected $resellerImages; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> + * @var ObjectStorage */ protected $teaserImages; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> + * @var ObjectStorage */ protected $headerImages; @@ -191,7 +194,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te protected $code = ''; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\MatchCode> + * @var ObjectStorage * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy */ protected $additionalCodes; @@ -207,32 +210,32 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te protected $category = self::CATEGORY_STANDARD; /** - * @var \EP\EpProducts\Domain\Model\Country + * @var Country */ protected $country; /** - * @var \EP\EpProducts\Domain\Model\Region + * @var Region */ protected $region; /** - * @var \EP\EpProducts\Domain\Model\City + * @var City */ protected $city; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Teammember> + * @var ObjectStorage */ protected $teamer; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product> + * @var ObjectStorage */ protected $products; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact> + * @var ObjectStorage */ protected $facts; @@ -246,6 +249,24 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te */ protected $pathSegment; + /** + * @var ObjectStorage + * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy + */ + protected $groupsPriceConfigs; + + /** + * @var ObjectStorage + * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy + */ + protected $groupsPriceOptions; + + /** + * @var ObjectStorage + * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy + */ + protected $groupsPriceBoards; + public function __construct() { $this->initStorageObjects(); @@ -253,14 +274,15 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te protected function initStorageObjects() { - $this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->resellerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->teaserImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->headerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->teamer = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->products = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->facts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->additionalCodes = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $this->images = new ObjectStorage(); + $this->resellerImages = new ObjectStorage(); + $this->teaserImages = new ObjectStorage(); + $this->headerImages = new ObjectStorage(); + $this->teamer = new ObjectStorage(); + $this->products = new ObjectStorage(); + $this->facts = new ObjectStorage(); + $this->additionalCodes = new ObjectStorage(); + $this->groupsPriceConfigs = new ObjectStorage(); } /** @@ -537,6 +559,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te if (empty($this->latitude) && $this->region !== null) { return $this->region->getLatitude(); } + return $this->latitude; } @@ -556,6 +579,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te if (empty($this->longitude) && $this->region !== null) { return $this->region->getLongitude(); } + return $this->longitude; } @@ -584,7 +608,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images + * @return ObjectStorage $images */ public function getImages() { @@ -592,15 +616,15 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images + * @param ObjectStorage $images */ - public function setImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $images) + public function setImages(ObjectStorage $images) { $this->images = $images; } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $resellerImages + * @return ObjectStorage $resellerImages */ public function getResellerImages() { @@ -608,7 +632,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $resellerImages + * @param ObjectStorage $resellerImages */ public function setResellerImages($resellerImages) { @@ -616,7 +640,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @return ObjectStorage */ public function getTeaserImages() { @@ -624,7 +648,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @return null|\TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @return null|ObjectStorage */ public function getTeaserImage() { @@ -632,11 +656,13 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te return null; } - return reset($this->teaserImages->toArray()); + $images = $this->teaserImages->toArray(); + + return reset($images); } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $teaserImages + * @param ObjectStorage $teaserImages */ public function setTeaserImages($teaserImages) { @@ -644,7 +670,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @return ObjectStorage */ public function getHeaderImages() { @@ -658,7 +684,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @return null|\TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @return null|ObjectStorage */ public function getHeaderImage() { @@ -666,11 +692,13 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te return null; } - return reset($this->headerImages->toArray()); + $images = $this->headerImages->toArray(); + + return reset($images); } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $headerImages + * @param ObjectStorage $headerImages */ public function setHeaderImages($headerImages) { @@ -694,23 +722,23 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \EP\EpProducts\Domain\Model\MatchCode $code + * @param MatchCode $code */ - public function addAdditionalCode(\EP\EpProducts\Domain\Model\MatchCode $code) + public function addAdditionalCode(MatchCode $code) { $this->additionalCodes->attach($code); } /** - * @param \EP\EpProducts\Domain\Model\MatchCode $codeToRemove + * @param MatchCode $codeToRemove */ - public function removeAdditionalCodes(\EP\EpProducts\Domain\Model\MatchCode $codeToRemove) + public function removeAdditionalCodes(MatchCode $codeToRemove) { $this->additionalCodes->detach($codeToRemove); } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\MatchCode> $codes + * @return ObjectStorage $codes */ public function getAdditionalCodes() { @@ -718,9 +746,9 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\MatchCode> $codes + * @param ObjectStorage $codes */ - public function setAdditionalCodes(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $codes) + public function setAdditionalCodes(ObjectStorage $codes) { $this->additionalCodes = $codes; } @@ -770,7 +798,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @return \EP\EpProducts\Domain\Model\Country $country + * @return Country $country */ public function getCountry() { @@ -778,15 +806,15 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \EP\EpProducts\Domain\Model\Country $country + * @param Country $country */ - public function setCountry(\EP\EpProducts\Domain\Model\Country $country) + public function setCountry(Country $country) { $this->country = $country; } /** - * @return \EP\EpProducts\Domain\Model\Region $region + * @return Region $region */ public function getRegion() { @@ -794,15 +822,15 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \EP\EpProducts\Domain\Model\Region $region + * @param Region $region */ - public function setRegion(\EP\EpProducts\Domain\Model\Region $region) + public function setRegion(Region $region) { $this->region = $region; } /** - * @return \EP\EpProducts\Domain\Model\City $city + * @return City $city */ public function getCity() { @@ -810,31 +838,31 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \EP\EpProducts\Domain\Model\City $city + * @param City $city */ - public function setCity(\EP\EpProducts\Domain\Model\City $city) + public function setCity(City $city) { $this->city = $city; } /** - * @param \EP\EpProducts\Domain\Model\Teammember $teamer + * @param Teammember $teamer */ - public function addTeamer(\EP\EpProducts\Domain\Model\Teammember $teamer) + public function addTeamer(Teammember $teamer) { $this->teamer->attach($teamer); } /** - * @param \EP\EpProducts\Domain\Model\Teammember $teamerToRemove The Teammember to be removed + * @param Teammember $teamerToRemove The Teammember to be removed */ - public function removeTeamer(\EP\EpProducts\Domain\Model\Teammember $teamerToRemove) + public function removeTeamer(Teammember $teamerToRemove) { $this->teamer->detach($teamerToRemove); } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Teammember> $teamer + * @return ObjectStorage $teamer */ public function getTeamer() { @@ -842,31 +870,31 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Teammember> $teamer + * @param ObjectStorage $teamer */ - public function setTeamer(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $teamer) + public function setTeamer(ObjectStorage $teamer) { $this->teamer = $teamer; } /** - * @param \EP\EpProducts\Domain\Model\Product $product + * @param Product $product */ - public function addProduct(\EP\EpProducts\Domain\Model\Product $product) + public function addProduct(Product $product) { $this->products->attach($product); } /** - * @param \EP\EpProducts\Domain\Model\Product $product + * @param Product $product */ - public function removeProduct(\EP\EpProducts\Domain\Model\Product $product) + public function removeProduct(Product $product) { $this->products->detach($product); } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product> + * @return ObjectStorage */ public function getProducts() { @@ -874,38 +902,38 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product> $products + * @param ObjectStorage $products */ - public function setProducts(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $products) + public function setProducts(ObjectStorage $products) { $this->products = $products; } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Room> $rooms + * @param ObjectStorage $rooms */ public function setRooms($rooms) { $this->rooms = $rooms; } /** - * @param \EP\EpProducts\Domain\Model\Fact $fact + * @param Fact $fact */ - public function addFact(\EP\EpProducts\Domain\Model\Fact $fact) + public function addFact(Fact $fact) { $this->facts->attach($fact); } /** - * @param \EP\EpProducts\Domain\Model\Fact $factToRemove + * @param Fact $factToRemove */ - public function removeFact(\EP\EpProducts\Domain\Model\Fact $factToRemove) + public function removeFact(Fact $factToRemove) { $this->facts->detach($factToRemove); } /** - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact> + * @return ObjectStorage */ public function getFacts() { @@ -913,9 +941,9 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te } /** - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact> $facts + * @param ObjectStorage $facts */ - public function setFacts(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $facts) + public function setFacts(ObjectStorage $facts) { $this->facts = $facts; } @@ -968,4 +996,51 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te return !$this->getIsApartment() && !$this->getIsHolidayFlat(); } + /** + * @return ObjectStorage + */ + public function getGroupsPriceConfigs() + { + return $this->groupsPriceConfigs; + } + + /** + * @param ObjectStorage $groupPriceConfigs + */ + public function setGroupsPriceConfigs(ObjectStorage $groupPriceConfigs) + { + $this->groupsPriceConfigs = $groupPriceConfigs; + } + + /** + * @return ObjectStorage + */ + public function getGroupsPriceOptions() + { + return $this->groupsPriceOptions; + } + + /** + * @param ObjectStorage $groupsPriceOptions + */ + public function setGroupsPriceOptions(ObjectStorage $groupsPriceOptions) + { + $this->groupsPriceOptions = $groupsPriceOptions; + } + + /** + * @return ObjectStorage + */ + public function getGroupsPriceBoards() + { + return $this->groupsPriceBoards; + } + + /** + * @param ObjectStorage $groupsPriceBoards + */ + public function setGroupsPriceBoards(ObjectStorage $groupsPriceBoards) + { + $this->groupsPriceBoards = $groupsPriceBoards; + } } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php b/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php index a1803e8a..110707ed 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php @@ -93,4 +93,13 @@ class LabelService $parameters['title'] = sprintf('%s: %s (%d/%d)', $date->format('d.m.Y'), $hotel['name'], $contingent['available'], $contingent['pax']); } + /** + * @param array $parameters + * @param array $parentObject + */ + public function getGroupsPriceConfigLabel(&$parameters, $parentObject) + { + $record = BackendUtility::getRecord('tx_epproducts_domain_model_groups_price_config', $parameters['row']['uid']); + $parameters['title'] = sprintf('%s - %s', date('d.m.Y', $record['date_from']), date('d.m.Y', $record['date_to'])); + } } diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php new file mode 100644 index 00000000..cd498cb2 --- /dev/null +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php @@ -0,0 +1,149 @@ + [ + 'title' => 'Verpflegungsleistung', + 'default_sortby' => 'ORDER BY price', + 'sortby' => 'sorting', + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'dividers2tabs' => true, + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', + ], + 'searchFields' => 'title', + 'iconfile' => 'EXT:ep_theme/Resources/Public/images/icon_ce.svg', + 'hideTable' => true, + ], + 'interface' => [ + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, price', + ], + 'types' => [ + '1' => [ + 'showitem' => 'title, price', + ], + ], + 'palettes' => [ + ], + 'columns' => [ + + 'sys_language_uid' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => [ + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1], + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0] + ], + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_epproducts_domain_model_groups_price_board', + 'foreign_table_where' => 'AND tx_epproducts_domain_model_groups_price_board.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groups_price_board.sys_language_uid IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + + 't3ver_label' => [ + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ] + ], + + 'hidden' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.hidden', + 'config' => [ + 'type' => 'check', + ], + ], + 'starttime' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'size' => 13, + 'eval' => 'datetime', + 'checkbox' => 0, + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'renderType' => 'inputDateTime', + ], + ], + 'endtime' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'size' => 13, + 'eval' => 'datetime', + 'checkbox' => 0, + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'renderType' => 'inputDateTime', + ], + ], + + 'title' => [ + 'exclude' => false, + 'label' => 'Bezeichnung', + 'config' => [ + 'type' => 'input', + 'size' => 32, + 'eval' => 'required', + ] + ], + 'price' => [ + 'exclude' => false, + 'label' => 'Preis pro Person/Nacht', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2,required', + ] + ], + 'sorting' => [ + 'config' => [ + 'type' => 'passthrough' + ] + ], + ], +]; diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php new file mode 100644 index 00000000..4939cf46 --- /dev/null +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php @@ -0,0 +1,176 @@ + [ + 'title' => 'Gruppenhaus Preis', + 'default_sortby' => 'ORDER BY date_from', + 'label' => 'date_from', + 'label_userFunc' => \EP\EpProducts\Service\LabelService::class . '->getGroupsPriceConfigLabel', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'dividers2tabs' => true, + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', + ], + 'searchFields' => 'date_from', + 'iconfile' => 'EXT:ep_theme/Resources/Public/images/icon_ce.svg', + 'hideTable' => true, + ], + 'interface' => [ + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date_from, date_to, + persons_included, price, price_additional_person', + ], + 'types' => [ + '1' => [ + 'showitem' => '--palette--;;dates, --palette--;;prices, persons_included', + ], + ], + 'palettes' => [ + 'dates' => ['showitem' => 'date_from, date_to'], + 'prices' => ['showitem' => 'price, price_additional_person'], + ], + 'columns' => [ + + 'sys_language_uid' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => [ + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1], + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0] + ], + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_epproducts_domain_model_groups_price_config', + 'foreign_table_where' => 'AND tx_epproducts_domain_model_groups_price_config.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groups_price_config.sys_language_uid IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + + 't3ver_label' => [ + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ] + ], + + 'hidden' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.hidden', + 'config' => [ + 'type' => 'check', + ], + ], + 'starttime' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'size' => 13, + 'eval' => 'datetime', + 'checkbox' => 0, + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'renderType' => 'inputDateTime', + ], + ], + 'endtime' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'size' => 13, + 'eval' => 'datetime', + 'checkbox' => 0, + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'renderType' => 'inputDateTime', + ], + ], + + 'date_from' => [ + 'exclude' => false, + 'label' => 'Datum von', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'date,required', + 'renderType' => 'inputDateTime', + ] + ], + 'date_to' => [ + 'exclude' => false, + 'label' => 'Datum bis', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'date,required', + 'renderType' => 'inputDateTime', + ] + ], + 'persons_included' => [ + 'exclude' => false, + 'label' => 'Inklusiv-Personen', + 'config' => [ + 'type' => 'input', + 'size' => 4, + 'eval' => 'int,required', + ] + ], + 'price' => [ + 'exclude' => false, + 'label' => 'Preis pro Nacht', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2,required', + ] + ], + 'price_additional_person' => [ + 'exclude' => false, + 'label' => 'Preis weitere Person', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2,required', + ] + ], + ], +]; diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php new file mode 100644 index 00000000..523eaab2 --- /dev/null +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php @@ -0,0 +1,149 @@ + [ + 'title' => 'Gruppenhaus Zusatzleistung', + 'default_sortby' => 'ORDER BY price', + 'sortby' => 'sorting', + 'label' => 'title', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'dividers2tabs' => true, + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', + ], + 'searchFields' => 'title', + 'iconfile' => 'EXT:ep_theme/Resources/Public/images/icon_ce.svg', + 'hideTable' => true, + ], + 'interface' => [ + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, price', + ], + 'types' => [ + '1' => [ + 'showitem' => 'title, price', + ], + ], + 'palettes' => [ + ], + 'columns' => [ + + 'sys_language_uid' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'sys_language', + 'foreign_table_where' => 'ORDER BY sys_language.title', + 'items' => [ + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1], + ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0] + ], + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_epproducts_domain_model_groups_price_option', + 'foreign_table_where' => 'AND tx_epproducts_domain_model_groups_price_option.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groups_price_option.sys_language_uid IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + + 't3ver_label' => [ + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ] + ], + + 'hidden' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.hidden', + 'config' => [ + 'type' => 'check', + ], + ], + 'starttime' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'size' => 13, + 'eval' => 'datetime', + 'checkbox' => 0, + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'renderType' => 'inputDateTime', + ], + ], + 'endtime' => [ + 'exclude' => 0, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'size' => 13, + 'eval' => 'datetime', + 'checkbox' => 0, + 'default' => 0, + 'range' => [ + 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], + 'renderType' => 'inputDateTime', + ], + ], + + 'title' => [ + 'exclude' => false, + 'label' => 'Bezeichnung', + 'config' => [ + 'type' => 'input', + 'size' => 32, + 'eval' => 'required', + ] + ], + 'price' => [ + 'exclude' => false, + 'label' => 'Preis', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2,required', + ] + ], + 'sorting' => [ + 'config' => [ + 'type' => 'passthrough' + ] + ], + ], +]; diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php index 2f34bd7a..1caf5d57 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php @@ -28,7 +28,7 @@ return [ address, longitude, latitude, headline, teaser, description, features, room_types, additional_information, teaser_images, header_images, images, reseller_images, code, type, category, country, region, city, facts, teamer, products, header_title,header_subtitle, earlybird, new, low_contingent, show_as_teaser, - external_link, path_segment', + external_link, path_segment, groups_price_configs, groups_price_boards, groups_price_options', ], 'types' => [ '1' => [ @@ -36,7 +36,8 @@ return [ --palette--;;destinations, --palette--;;categories, keywords, --div--;Texte, teaser, description, features, room_types, additional_information, --div--;Verknüpfungen, facts, teamer, additional_codes, - --div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images', + --div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images, + --div--;Gruppenhaus Preise, groups_price_configs, groups_price_boards, groups_price_options', ], ], 'palettes' => [ @@ -592,7 +593,7 @@ return [ 'additional_codes' => [ 'exclude' => 0, 'label' => 'Zusätzliche Codes', - 'config' => array( + 'config' => [ 'type' => 'inline', 'foreign_table' => 'tx_epproducts_domain_model_matchcode', 'foreign_field' => 'entity', @@ -600,15 +601,15 @@ return [ 'entity_type' => 'hotel', ], 'maxitems' => 10, - 'appearance' => array( + 'appearance' => [ 'collapseAll' => 1, 'levelLinksPosition' => 'top', 'showSynchronizationLink' => 0, 'showPossibleLocalizationRecords' => 0, 'showAllLocalizationLink' => 0, 'expandSingle' => 1, - ), - ), + ], + ], ], 'latitude' => [ 'exclude' => 0, @@ -654,5 +655,64 @@ return [ 'eval' => 'uniqueInSite', ], ], + 'groups_price_configs' => [ + 'exclude' => 0, + 'label' => 'Preiskonfigurationen', + 'config' => [ + 'type' => 'inline', + 'foreign_table' => 'tx_epproducts_domain_model_groups_price_config', + 'foreign_field' => 'hotel', + 'maxitems' => 99, + 'minitems' => 0, + 'appearance' => [ + 'collapseAll' => 1, + 'levelLinksPosition' => 'top', + 'showSynchronizationLink' => 0, + 'showPossibleLocalizationRecords' => 0, + 'showAllLocalizationLink' => 0, + 'expandSingle' => 1, + ], + ], + ], + 'groups_price_boards' => [ + 'exclude' => 0, + 'label' => 'Verpflegungsleistungen', + 'config' => [ + 'type' => 'inline', + 'foreign_table' => 'tx_epproducts_domain_model_groups_price_board', + 'foreign_field' => 'hotel', + 'maxitems' => 99, + 'minitems' => 0, + 'appearance' => [ + 'useSortable' => true, + 'collapseAll' => 1, + 'levelLinksPosition' => 'top', + 'showSynchronizationLink' => 0, + 'showPossibleLocalizationRecords' => 0, + 'showAllLocalizationLink' => 0, + 'expandSingle' => 1, + ], + ], + ], + 'groups_price_options' => [ + 'exclude' => 0, + 'label' => 'Optionale Zusatzleistungen', + 'config' => [ + 'type' => 'inline', + 'foreign_table' => 'tx_epproducts_domain_model_groups_price_option', + 'foreign_field' => 'hotel', + 'maxitems' => 99, + 'minitems' => 0, + 'appearance' => [ + 'useSortable' => true, + 'collapseAll' => 1, + 'levelLinksPosition' => 'top', + 'showSynchronizationLink' => 0, + 'showPossibleLocalizationRecords' => 0, + 'showAllLocalizationLink' => 0, + 'expandSingle' => 1, + ], + ], + ], ], ]; diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index 123cf0c0..9a7c3b79 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -238,6 +238,9 @@ CREATE TABLE tx_epproducts_domain_model_hotel address varchar(255) DEFAULT '' NOT NULL, latitude varchar(255) DEFAULT '' NOT NULL, longitude varchar(255) DEFAULT '' NOT NULL, + groups_price_configs int(11) unsigned NOT NULL default '0', + groups_price_options int(11) unsigned NOT NULL default '0', + groups_price_boards int(11) unsigned NOT NULL default '0', tstamp int(11) unsigned DEFAULT '0' NOT NULL, crdate int(11) unsigned DEFAULT '0' NOT NULL, @@ -268,6 +271,137 @@ CREATE TABLE tx_epproducts_domain_model_hotel ); +# +# Table structure for table 'tx_epproducts_domain_model_groups_price_config' +# +CREATE TABLE tx_epproducts_domain_model_groups_price_config +( + + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + date_from int(11) unsigned DEFAULT '0' NOT NULL, + date_to int(11) unsigned DEFAULT '0' NOT NULL, + persons_included int(11) unsigned DEFAULT '0' NOT NULL, + price float(8) unsigned DEFAULT '0' NOT NULL, + price_additional_person float(8) unsigned DEFAULT '0' NOT NULL, + hotel int(11) unsigned DEFAULT '0', + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY t3ver_oid (t3ver_oid, t3ver_wsid), + KEY language (l10n_parent, sys_language_uid) + +); + +# +# Table structure for table 'tx_epproducts_domain_model_groups_price_option' +# +CREATE TABLE tx_epproducts_domain_model_groups_price_option +( + + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + title varchar(255) DEFAULT '' NOT NULL, + price float(8) unsigned DEFAULT '0' NOT NULL, + hotel int(11) unsigned DEFAULT '0', + sorting int(11) DEFAULT '0' NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY t3ver_oid (t3ver_oid, t3ver_wsid), + KEY language (l10n_parent, sys_language_uid) + +); + +# +# Table structure for table 'tx_epproducts_domain_model_groups_price_board' +# +CREATE TABLE tx_epproducts_domain_model_groups_price_board +( + + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + title varchar(255) DEFAULT '' NOT NULL, + price float(8) unsigned DEFAULT '0' NOT NULL, + hotel int(11) unsigned DEFAULT '0', + sorting int(11) DEFAULT '0' NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY t3ver_oid (t3ver_oid, t3ver_wsid), + KEY language (l10n_parent, sys_language_uid) + +); + # # Table structure for table 'tx_epproducts_domain_model_room' # From be909049d1f7820cb1ad07e8c770b07c3ff52355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Fri, 10 Jan 2020 14:59:14 +0100 Subject: [PATCH 2/4] Fix tca filenames --- .../Classes/Domain/Model/GroupsPriceBoard.php | 13 +++- .../Domain/Model/GroupsPriceConfig.php | 16 ++++- .../Domain/Model/GroupsPriceOption.php | 13 +++- .../Classes/Domain/Model/Hotel.php | 59 +++++++++---------- .../Classes/Service/LabelService.php | 2 +- ...roducts_domain_model_groupspriceboard.php} | 4 +- ...oducts_domain_model_groupspriceconfig.php} | 4 +- ...oducts_domain_model_groupspriceoption.php} | 4 +- .../TCA/tx_epproducts_domain_model_hotel.php | 6 +- .../typo3conf/ext/ep_products/ext_tables.sql | 12 ++-- 10 files changed, 84 insertions(+), 49 deletions(-) rename public/typo3conf/ext/ep_products/Configuration/TCA/{tx_epproducts_domain_model_groups_price_board.php => tx_epproducts_domain_model_groupspriceboard.php} (97%) rename public/typo3conf/ext/ep_products/Configuration/TCA/{tx_epproducts_domain_model_groups_price_config.php => tx_epproducts_domain_model_groupspriceconfig.php} (97%) rename public/typo3conf/ext/ep_products/Configuration/TCA/{tx_epproducts_domain_model_groups_price_option.php => tx_epproducts_domain_model_groupspriceoption.php} (97%) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php index 7932cace..71c6fd21 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceBoard.php @@ -29,7 +29,7 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class GroupsPriceBoard extends AbstractEntity +class GroupsPriceBoard extends AbstractEntity implements \JsonSerializable { /** * @var string @@ -72,4 +72,15 @@ class GroupsPriceBoard extends AbstractEntity { $this->price = $price; } + + /** + * @return array + */ + public function jsonSerialize() + { + return [ + 'title' => $this->getTitle(), + 'price' => $this->getPrice(), + ]; + } } \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php index 8713cd45..a1b7d8ab 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php @@ -29,7 +29,7 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class GroupsPriceConfig extends AbstractEntity +class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable { /** * @var \DateTime @@ -135,4 +135,18 @@ class GroupsPriceConfig extends AbstractEntity { $this->priceAdditionalPerson = $priceAdditionalPerson; } + + /** + * @return array + */ + public function jsonSerialize() + { + return [ + 'dateFrom' => $this->getDateFrom()->format('d.m.Y'), + 'dateTo' => $this->getDateTo()->format('d.m.Y'), + 'personsIncluded' => $this->getPersonsIncluded(), + 'price' => $this->getPrice(), + 'priceAdditionalPerson' => $this->getPriceAdditionalPerson(), + ]; + } } \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php index 4fa0111d..63f4d534 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceOption.php @@ -29,7 +29,7 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -class GroupsPriceOption extends AbstractEntity +class GroupsPriceOption extends AbstractEntity implements \JsonSerializable { /** * @var string @@ -72,4 +72,15 @@ class GroupsPriceOption extends AbstractEntity { $this->price = $price; } + + /** + * @return array + */ + public function jsonSerialize() + { + return [ + 'title' => $this->getTitle(), + 'price' => $this->getPrice(), + ]; + } } \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php index 9e73e522..7151ecb5 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php @@ -169,22 +169,22 @@ class Hotel extends AbstractEntity implements TeaserInterface protected $address = ''; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> */ protected $images; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> */ protected $resellerImages; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> */ protected $teaserImages; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> */ protected $headerImages; @@ -194,7 +194,7 @@ class Hotel extends AbstractEntity implements TeaserInterface protected $code = ''; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\MatchCode> * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy */ protected $additionalCodes; @@ -210,32 +210,32 @@ class Hotel extends AbstractEntity implements TeaserInterface protected $category = self::CATEGORY_STANDARD; /** - * @var Country + * @var \EP\EpProducts\Domain\Model\Country */ protected $country; /** - * @var Region + * @var \EP\EpProducts\Domain\Model\Region */ protected $region; /** - * @var City + * @var \EP\EpProducts\Domain\Model\City */ protected $city; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Teammember> */ protected $teamer; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product> */ protected $products; /** - * @var ObjectStorage + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Fact> */ protected $facts; @@ -250,20 +250,17 @@ class Hotel extends AbstractEntity implements TeaserInterface protected $pathSegment; /** - * @var ObjectStorage - * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\GroupsPriceConfig> */ protected $groupsPriceConfigs; /** - * @var ObjectStorage - * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\GroupsPriceOption> */ protected $groupsPriceOptions; /** - * @var ObjectStorage - * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\GroupsPriceBoard> */ protected $groupsPriceBoards; @@ -283,6 +280,8 @@ class Hotel extends AbstractEntity implements TeaserInterface $this->facts = new ObjectStorage(); $this->additionalCodes = new ObjectStorage(); $this->groupsPriceConfigs = new ObjectStorage(); + $this->groupsPriceOptions = new ObjectStorage(); + $this->groupsPriceBoards = new ObjectStorage(); } /** @@ -862,7 +861,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @return ObjectStorage $teamer + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $teamer */ public function getTeamer() { @@ -870,7 +869,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $teamer + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $teamer */ public function setTeamer(ObjectStorage $teamer) { @@ -894,7 +893,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @return ObjectStorage + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ public function getProducts() { @@ -902,7 +901,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $products + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $products */ public function setProducts(ObjectStorage $products) { @@ -910,7 +909,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $rooms + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $rooms */ public function setRooms($rooms) { $this->rooms = $rooms; @@ -933,7 +932,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @return ObjectStorage + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ public function getFacts() { @@ -941,7 +940,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $facts + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $facts */ public function setFacts(ObjectStorage $facts) { @@ -997,7 +996,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @return ObjectStorage + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ public function getGroupsPriceConfigs() { @@ -1005,7 +1004,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $groupPriceConfigs + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $groupPriceConfigs */ public function setGroupsPriceConfigs(ObjectStorage $groupPriceConfigs) { @@ -1013,7 +1012,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @return ObjectStorage + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ public function getGroupsPriceOptions() { @@ -1021,7 +1020,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $groupsPriceOptions + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $groupsPriceOptions */ public function setGroupsPriceOptions(ObjectStorage $groupsPriceOptions) { @@ -1029,7 +1028,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @return ObjectStorage + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ public function getGroupsPriceBoards() { @@ -1037,7 +1036,7 @@ class Hotel extends AbstractEntity implements TeaserInterface } /** - * @param ObjectStorage $groupsPriceBoards + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $groupsPriceBoards */ public function setGroupsPriceBoards(ObjectStorage $groupsPriceBoards) { diff --git a/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php b/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php index 110707ed..b9e3e38b 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/LabelService.php @@ -99,7 +99,7 @@ class LabelService */ public function getGroupsPriceConfigLabel(&$parameters, $parentObject) { - $record = BackendUtility::getRecord('tx_epproducts_domain_model_groups_price_config', $parameters['row']['uid']); + $record = BackendUtility::getRecord('tx_epproducts_domain_model_groupspriceconfig', $parameters['row']['uid']); $parameters['title'] = sprintf('%s - %s', date('d.m.Y', $record['date_from']), date('d.m.Y', $record['date_to'])); } } diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceboard.php similarity index 97% rename from public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php rename to public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceboard.php index cd498cb2..cf687993 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_board.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceboard.php @@ -59,8 +59,8 @@ return [ 'items' => [ ['', 0], ], - 'foreign_table' => 'tx_epproducts_domain_model_groups_price_board', - 'foreign_table_where' => 'AND tx_epproducts_domain_model_groups_price_board.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groups_price_board.sys_language_uid IN (-1,0)', + 'foreign_table' => 'tx_epproducts_domain_model_groupspriceboard', + 'foreign_table_where' => 'AND tx_epproducts_domain_model_groupspriceboard.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groupspriceboard.sys_language_uid IN (-1,0)', ], ], 'l10n_diffsource' => [ diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php similarity index 97% rename from public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php rename to public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php index 4939cf46..f66297d1 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_config.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php @@ -62,8 +62,8 @@ return [ 'items' => [ ['', 0], ], - 'foreign_table' => 'tx_epproducts_domain_model_groups_price_config', - 'foreign_table_where' => 'AND tx_epproducts_domain_model_groups_price_config.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groups_price_config.sys_language_uid IN (-1,0)', + 'foreign_table' => 'tx_epproducts_domain_model_groupspriceconfig', + 'foreign_table_where' => 'AND tx_epproducts_domain_model_groupspriceconfig.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groupspriceconfig.sys_language_uid IN (-1,0)', ], ], 'l10n_diffsource' => [ diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceoption.php similarity index 97% rename from public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php rename to public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceoption.php index 523eaab2..7808a59b 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groups_price_option.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceoption.php @@ -59,8 +59,8 @@ return [ 'items' => [ ['', 0], ], - 'foreign_table' => 'tx_epproducts_domain_model_groups_price_option', - 'foreign_table_where' => 'AND tx_epproducts_domain_model_groups_price_option.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groups_price_option.sys_language_uid IN (-1,0)', + 'foreign_table' => 'tx_epproducts_domain_model_groupspriceoption', + 'foreign_table_where' => 'AND tx_epproducts_domain_model_groupspriceoption.pid=###CURRENT_PID### AND tx_epproducts_domain_model_groupspriceoption.sys_language_uid IN (-1,0)', ], ], 'l10n_diffsource' => [ diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php index 1caf5d57..48bd6326 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php @@ -660,7 +660,7 @@ return [ 'label' => 'Preiskonfigurationen', 'config' => [ 'type' => 'inline', - 'foreign_table' => 'tx_epproducts_domain_model_groups_price_config', + 'foreign_table' => 'tx_epproducts_domain_model_groupspriceconfig', 'foreign_field' => 'hotel', 'maxitems' => 99, 'minitems' => 0, @@ -679,7 +679,7 @@ return [ 'label' => 'Verpflegungsleistungen', 'config' => [ 'type' => 'inline', - 'foreign_table' => 'tx_epproducts_domain_model_groups_price_board', + 'foreign_table' => 'tx_epproducts_domain_model_groupspriceboard', 'foreign_field' => 'hotel', 'maxitems' => 99, 'minitems' => 0, @@ -699,7 +699,7 @@ return [ 'label' => 'Optionale Zusatzleistungen', 'config' => [ 'type' => 'inline', - 'foreign_table' => 'tx_epproducts_domain_model_groups_price_option', + 'foreign_table' => 'tx_epproducts_domain_model_groupspriceoption', 'foreign_field' => 'hotel', 'maxitems' => 99, 'minitems' => 0, diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index 9a7c3b79..7bccd587 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -272,9 +272,9 @@ CREATE TABLE tx_epproducts_domain_model_hotel ); # -# Table structure for table 'tx_epproducts_domain_model_groups_price_config' +# Table structure for table 'tx_epproducts_domain_model_groupspriceconfig' # -CREATE TABLE tx_epproducts_domain_model_groups_price_config +CREATE TABLE tx_epproducts_domain_model_groupspriceconfig ( uid int(11) NOT NULL auto_increment, @@ -317,9 +317,9 @@ CREATE TABLE tx_epproducts_domain_model_groups_price_config ); # -# Table structure for table 'tx_epproducts_domain_model_groups_price_option' +# Table structure for table 'tx_epproducts_domain_model_groupspriceoption' # -CREATE TABLE tx_epproducts_domain_model_groups_price_option +CREATE TABLE tx_epproducts_domain_model_groupspriceoption ( uid int(11) NOT NULL auto_increment, @@ -360,9 +360,9 @@ CREATE TABLE tx_epproducts_domain_model_groups_price_option ); # -# Table structure for table 'tx_epproducts_domain_model_groups_price_board' +# Table structure for table 'tx_epproducts_domain_model_groupspriceboard' # -CREATE TABLE tx_epproducts_domain_model_groups_price_board +CREATE TABLE tx_epproducts_domain_model_groupspriceboard ( uid int(11) NOT NULL auto_increment, From 70f21a28b9c2f13f1ed3cabf0b230648383014e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Fri, 10 Jan 2020 14:59:48 +0100 Subject: [PATCH 3/4] Implement ajax endpoint for prices --- .../Controller/AjaxGroupsPriceController.php | 91 +++++++++++++++++++ .../Classes/Service/GroupsPriceService.php | 80 ++++++++++++++++ .../Configuration/TypoScript/setup.typoscript | 4 + .../ext/ep_products/ext_localconf.php | 3 + .../js/components/GroupsPriceCalculator.vue | 27 ++++++ .../Assets/js/components/ProductDetail.vue | 2 + .../Private/Templates/Product/Detail.html | 3 + 7 files changed, 210 insertions(+) create mode 100644 public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php create mode 100644 public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php create mode 100644 public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php new file mode 100644 index 00000000..4f8c54ea --- /dev/null +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php @@ -0,0 +1,91 @@ +, dreipunktnull + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use EP\EpProducts\Domain\Model\Hotel; +use EP\EpProducts\Service\GroupsPriceService; +use League\Period\Period; +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; + +class AjaxGroupsPriceController extends ActionController +{ + /** + * @var GroupsPriceService + */ + protected $groupsPriceService; + + public function __construct(GroupsPriceService $groupsPriceService) + { + parent::__construct(); + + $this->groupsPriceService = $groupsPriceService; + } + + /** + * @param Hotel $hotel + * @return string + */ + public function configsAction(Hotel $hotel) + { + return json_encode([ + 'configs' => $hotel->getGroupsPriceConfigs()->toArray(), + 'boards' => $hotel->getGroupsPriceBoards()->toArray(), + 'options' => $hotel->getGroupsPriceOptions()->toArray(), + ], JSON_THROW_ON_ERROR, 512); + } + + public function initializePriceAction() + { + if ($this->request->hasArgument('dateFrom')) { + $dateFrom = new \DateTime($this->request->getArgument('dateFrom')); + $this->request->setArgument('dateFrom', $dateFrom); + } + if ($this->request->hasArgument('dateTo')) { + $dateTo = new \DateTime($this->request->getArgument('dateTo')); + $this->request->setArgument('dateTo', $dateTo); + } + } + + /** + * @param Hotel $hotel + * @param \DateTime $dateFrom + * @param \DateTime $dateTo + * @param int $pax + * @return string + * @throws \League\Period\Exception + */ + public function priceAction(Hotel $hotel, \DateTime $dateFrom, \DateTime $dateTo, $pax) + { + $period = new Period($dateFrom, $dateTo); + $price = $this->groupsPriceService->calculateHotelPrice($hotel, $period, $pax); + + return json_encode([ + 'price' => $price, + ], JSON_THROW_ON_ERROR, 512); + } +} diff --git a/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php b/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php new file mode 100644 index 00000000..f44deadf --- /dev/null +++ b/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php @@ -0,0 +1,80 @@ +getConfigs($hotel); + + // Create periods in configs to simplify following steps + $this->patchConfigPeriods($configs); + + $price = 0; + + // Iterate over all days in provided period + foreach ($period->getDatePeriod('1 DAY') as $day) { + + // Iterate over all configs + foreach ($configs as $config) { + + // Skip config if current day is not contained + if (false === $config['period']->contains($day)) { + continue; + } + + // Calculate base price + $price += $config['price']; + + // Add costs for not-included number of persons + if ($pax > $config['persons_included']) { + $price += $config['price_additional_person'] * ($pax - $config['persons_included']); + } + } + } + + return $price; + } + + protected function patchConfigPeriods(array &$configs) + { + foreach ($configs as $idx => $config) { + $configDateFrom = (new \DateTimeImmutable())->setTimestamp($config['date_from']); + $configDateTo = (new \DateTimeImmutable())->setTimestamp($config['date_to']); + $configs[$idx]['period'] = new Period($configDateFrom, $configDateTo); + } + } + + /** + * @param Hotel $hotel + * @return array + */ + protected function getConfigs(Hotel $hotel) + { + $qb = $this->getQueryBuilder(); + + return $qb + ->select('*') + ->from('tx_epproducts_domain_model_groupspriceconfig') + ->where($qb->expr()->eq('hotel', $qb->createNamedParameter($hotel->getUid()))) + ->orderBy('date_from') + ->execute() + ->fetchAll() + ; + } + + protected function getQueryBuilder() + { + /** @var ConnectionPool $connectionPool */ + $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); + + return $connectionPool->getQueryBuilderForTable('tx_epproducts_domain_model_groupspriceconfig'); + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript index 7f1e426c..5be9ade7 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript @@ -133,6 +133,10 @@ tx_epproducts_ajax_json { AjaxWatchlist { 1 = list } + AjaxGroupsPrice { + 1 = configs + 2 = price + } } features.requireCHashArgumentForActionArguments = 0 settings =< plugin.tx_epproducts.settings diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index b32051ff..83c46f2d 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -345,6 +345,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', 'AjaxCalendar' => 'range,contingents,availableRooms', 'AjaxWatchlist' => 'list', + 'AjaxGroupsPrice' => 'configs,price', ], [ 'AjaxSearch' => 'searchresult', @@ -355,6 +356,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', 'AjaxCalendar' => 'range,contingents,availableRooms', 'AjaxWatchlist' => 'list', + 'AjaxGroupsPrice' => 'configs,price', ] ); @@ -382,6 +384,7 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epp $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[months]'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[month]'; $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[year]'; +$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_epproducts_ajax[hotel]'; $GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpProducts']['Controller']['writerConfiguration'] = [ \TYPO3\CMS\Core\Log\LogLevel::INFO => [ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue new file mode 100644 index 00000000..ee647cad --- /dev/null +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue @@ -0,0 +1,27 @@ + + + diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue index cbc22ec8..dbd0234b 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue @@ -11,6 +11,7 @@ import DaterangeSelect from './DaterangeSelect.vue' import AjaxContent from './AjaxContent.vue' import Calendar from './Calendar.vue' + import GroupsPriceCalculator from './GroupsPriceCalculator.vue'; import FacebookPixel from './FacebookPixel.vue' import WatchlistToggle from './WatchlistToggle.vue' import OsmMap from './OsmMap.vue' @@ -28,6 +29,7 @@ DaterangeSelect, AjaxContent, Calendar, + GroupsPriceCalculator, FacebookPixel, WatchlistToggle, OsmMap, diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html index 52e4e8ed..c2b101a1 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html @@ -248,6 +248,9 @@ +

Belegungskalender

Date: Fri, 10 Jan 2020 19:46:13 +0100 Subject: [PATCH 4/4] WIP Implement price calculation and frontend --- .../Controller/AjaxGroupsPriceController.php | 44 ++++++++++--------- .../Classes/Service/GroupsPriceService.php | 29 +++++++++++- .../Configuration/TypoScript/setup.typoscript | 3 +- .../ext/ep_products/ext_localconf.php | 4 +- .../js/components/GroupsPriceCalculator.vue | 28 +++++++++++- .../Assets/js/components/ProductDetail.vue | 3 +- .../Private/Templates/Product/Detail.html | 10 +++-- 7 files changed, 89 insertions(+), 32 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php index 4f8c54ea..70b2e9f9 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php @@ -31,6 +31,7 @@ use EP\EpProducts\Domain\Model\Hotel; use EP\EpProducts\Service\GroupsPriceService; use League\Period\Period; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException; class AjaxGroupsPriceController extends ActionController { @@ -46,27 +47,25 @@ class AjaxGroupsPriceController extends ActionController $this->groupsPriceService = $groupsPriceService; } - /** - * @param Hotel $hotel - * @return string - */ - public function configsAction(Hotel $hotel) - { - return json_encode([ - 'configs' => $hotel->getGroupsPriceConfigs()->toArray(), - 'boards' => $hotel->getGroupsPriceBoards()->toArray(), - 'options' => $hotel->getGroupsPriceOptions()->toArray(), - ], JSON_THROW_ON_ERROR, 512); - } - - public function initializePriceAction() + public function initializeAction() { if ($this->request->hasArgument('dateFrom')) { - $dateFrom = new \DateTime($this->request->getArgument('dateFrom')); + try { + $dateFrom = new \DateTime($this->request->getArgument('dateFrom')); + } + catch (\Throwable $e) { + $dateFrom = null; + } $this->request->setArgument('dateFrom', $dateFrom); } + if ($this->request->hasArgument('dateTo')) { - $dateTo = new \DateTime($this->request->getArgument('dateTo')); + try { + $dateTo = new \DateTime($this->request->getArgument('dateTo')); + } + catch (\Throwable $e) { + $dateTo = null; + } $this->request->setArgument('dateTo', $dateTo); } } @@ -79,13 +78,18 @@ class AjaxGroupsPriceController extends ActionController * @return string * @throws \League\Period\Exception */ - public function priceAction(Hotel $hotel, \DateTime $dateFrom, \DateTime $dateTo, $pax) + public function indexAction(Hotel $hotel, \DateTime $dateFrom = null, \DateTime $dateTo = null, $pax = 0) { - $period = new Period($dateFrom, $dateTo); - $price = $this->groupsPriceService->calculateHotelPrice($hotel, $period, $pax); + if (null !== $dateFrom && null !== $dateTo) { + $period = new Period($dateFrom, $dateTo); + $price = $this->groupsPriceService->calculateHotelPrice($hotel, $period, $pax); + } return json_encode([ - 'price' => $price, + 'price' => $price ?? [], + 'configs' => $hotel->getGroupsPriceConfigs()->toArray(), + 'boards' => $hotel->getGroupsPriceBoards()->toArray(), + 'options' => $hotel->getGroupsPriceOptions()->toArray(), ], JSON_THROW_ON_ERROR, 512); } } diff --git a/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php b/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php index f44deadf..cc174e83 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/GroupsPriceService.php @@ -9,6 +9,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; class GroupsPriceService { + /** + * @param Hotel $hotel + * @param Period $period + * @param int $pax + * @return array + */ public function calculateHotelPrice(Hotel $hotel, Period $period, $pax) { // Get all price configs for provided hotel @@ -17,9 +23,10 @@ class GroupsPriceService // Create periods in configs to simplify following steps $this->patchConfigPeriods($configs); + $nights = 0; $price = 0; - // Iterate over all days in provided period + // Iterate over provided period foreach ($period->getDatePeriod('1 DAY') as $day) { // Iterate over all configs @@ -38,9 +45,27 @@ class GroupsPriceService $price += $config['price_additional_person'] * ($pax - $config['persons_included']); } } + + $nights++; } - return $price; + if ($nights === 2) { + $shortTermCosts = $price * .2; + } + + if ($nights === 3) { + $shortTermCosts = $price * .1; + } + + $electricityCosts = ($nights - 1) * $pax * 1.7; + + return [ + 'pax' => $pax, + 'basePrice' => $price, + 'shortTermCosts' => $shortTermCosts ?? 0.0, + 'electricityCosts' => $electricityCosts, + 'nights' => $nights, + ]; } protected function patchConfigPeriods(array &$configs) diff --git a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript index 5be9ade7..a770a066 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript +++ b/public/typo3conf/ext/ep_products/Configuration/TypoScript/setup.typoscript @@ -134,8 +134,7 @@ tx_epproducts_ajax_json { 1 = list } AjaxGroupsPrice { - 1 = configs - 2 = price + 1 = index } } features.requireCHashArgumentForActionArguments = 0 diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 83c46f2d..255c1ddf 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -345,7 +345,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', 'AjaxCalendar' => 'range,contingents,availableRooms', 'AjaxWatchlist' => 'list', - 'AjaxGroupsPrice' => 'configs,price', + 'AjaxGroupsPrice' => 'index', ], [ 'AjaxSearch' => 'searchresult', @@ -356,7 +356,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T 'AjaxTable' => 'pricetable,pricetableHtml,eventPricetable', 'AjaxCalendar' => 'range,contingents,availableRooms', 'AjaxWatchlist' => 'list', - 'AjaxGroupsPrice' => 'configs,price', + 'AjaxGroupsPrice' => 'index', ] ); diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue index ee647cad..1f423707 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue @@ -1,11 +1,12 @@ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue index dbd0234b..edf8ea47 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/ProductDetail.vue @@ -11,7 +11,6 @@ import DaterangeSelect from './DaterangeSelect.vue' import AjaxContent from './AjaxContent.vue' import Calendar from './Calendar.vue' - import GroupsPriceCalculator from './GroupsPriceCalculator.vue'; import FacebookPixel from './FacebookPixel.vue' import WatchlistToggle from './WatchlistToggle.vue' import OsmMap from './OsmMap.vue' @@ -29,7 +28,7 @@ DaterangeSelect, AjaxContent, Calendar, - GroupsPriceCalculator, + GroupsPriceCalculator: () => import('./GroupsPriceCalculator.vue'), FacebookPixel, WatchlistToggle, OsmMap, diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html index c2b101a1..efd8fef0 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Product/Detail.html @@ -87,6 +87,13 @@