diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php deleted file mode 100644 index 31514b51..00000000 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php +++ /dev/null @@ -1,170 +0,0 @@ -, 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\Dto\GroupsPriceInquiry; -use EP\EpProducts\Domain\Model\GroupsPriceBoard; -use EP\EpProducts\Domain\Model\GroupsPriceOption; -use EP\EpProducts\Domain\Model\Hotel; -use EP\EpProducts\Domain\Repository\GroupsPriceOptionRepository; -use EP\EpProducts\Service\EmailService; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; - -class AjaxGroupsPriceController extends ActionController -{ - /** - * @var GroupsPriceOptionRepository - */ - protected $groupsPriceOptionRepository; - - /** - * @var EmailService - */ - protected $emailService; - - public function __construct(GroupsPriceOptionRepository $groupsPriceOptionRepository, EmailService $emailService) - { - $this->groupsPriceOptionRepository = $groupsPriceOptionRepository; - $this->emailService = $emailService; - } - - public function initializeProcessFormAction() - { - if ($this->request->hasArgument('groupsPriceInquiry')) { - $this->arguments->getArgument('groupsPriceInquiry') - ->getPropertyMappingConfiguration()->allowAllProperties(); - } - } - - /** - * @param Hotel $hotel - * @param GroupsPriceInquiry $groupsPriceInquiry - * @return string - */ - public function processFormAction(Hotel $hotel, GroupsPriceInquiry $groupsPriceInquiry) - { - $mode = $groupsPriceInquiry->getMode(); - $country = $hotel->getCountry()->getCode(); - $effectivePax = $groupsPriceInquiry->getEffectivePax(); - $nights = $groupsPriceInquiry->getNights(); - - if (false === in_array($mode, [GroupsPriceInquiry::MODE_BOOKING, GroupsPriceInquiry::MODE_INQUIRY])) { - $mode = GroupsPriceInquiry::MODE_BOOKING; - } - - $subject = GroupsPriceInquiry::MODE_BOOKING ? - 'Gruppenhaus Preisberechnung/Buchung' : 'Gruppenhaus Preisberechnung/Anfrage'; - - $emailOptions = [ - 'toEmail' => $this->settings['groupsPriceToEmail'], - 'toName' => $this->settings['groupsPriceToName'], - 'fromEmail' => $this->settings['groupsPriceToEmail'], - 'fromName' => $this->settings['groupsPriceToName'], - 'subject' => $subject, - 'templateName' => 'GroupsPrice', - ]; - - $optionPrice = function (GroupsPriceOption $option) use ($country, $effectivePax, $nights) { - $price = 'CH' === $country ? $option->getPriceChf() : $option->getPrice(); - $currency = 'CH' === $country ? 'CHF' : '€'; - - if (GroupsPriceOption::TYPE_PER_PAX === $option->getType()) { - $price = $price * $effectivePax; - } elseif (GroupsPriceOption::TYPE_PER_NIGHT === $option->getType()) { - $price = $price * $nights; - } elseif (GroupsPriceOption::TYPE_PER_PAX_AND_NIGHT === $option->getType()) { - $price = $price * $nights * $effectivePax; - } - - return $price.' '.$currency; - }; - - try { - $options = $this->groupsPriceOptionRepository->findByUids($groupsPriceInquiry->getOptions()); - $selectedOptions = array_map(function ($option) use ($optionPrice) { - return $option->getTitle().': '.$optionPrice($option); - }, $options); - } - catch (InvalidQueryException $e) { - $selectedOptions = []; - } - - $variables = [ - 'mode' => $mode, - 'hotel' => $hotel, - 'name' => $groupsPriceInquiry->getName(), - 'group' => $groupsPriceInquiry->getGroup(), - 'street' => $groupsPriceInquiry->getStreet(), - 'postcode' => $groupsPriceInquiry->getPostcode(), - 'city' => $groupsPriceInquiry->getCity(), - 'email' => $groupsPriceInquiry->getEmail(), - 'phone' => $groupsPriceInquiry->getPhone(), - 'remarks' => $groupsPriceInquiry->getRemarks(), - 'dateFrom' => $groupsPriceInquiry->getDateFrom(), - 'dateTo' => $groupsPriceInquiry->getDateTo(), - 'nights' => $groupsPriceInquiry->getNights(), - 'pax' => $groupsPriceInquiry->getPax(), - 'children' => $groupsPriceInquiry->getChildren(), - 'minors' => $groupsPriceInquiry->getMinors(), - 'adolescents' => $groupsPriceInquiry->getAdolescents(), - 'adolescentsAge' => $hotel->getGroupsPriceAdolescentsAge(), - 'options' => $selectedOptions, - 'board' => $groupsPriceInquiry->getBoard(), - 'summary' => $groupsPriceInquiry->getSummary(), - ]; - - $this->emailService->send($emailOptions, $variables); - - return json_encode(['status' => 'ok'], JSON_THROW_ON_ERROR, 512); - } - - /** - * @return string - */ - protected function errorAction() { - $formErrors = []; - if ($this->arguments->validate()->hasErrors()) { - foreach ($this->arguments->validate()->getFlattenedErrors() as $key => $errors) { - $parts = explode('.', $key); - $fieldName = array_pop($parts); - $errorsRaw = []; - foreach ($errors as $error) { - $translationKey = sprintf('tx_eptheme.message.%s.%s', $fieldName, $error->getCode()); - $errorsRaw[] = LocalizationUtility::translate($translationKey, 'ep_theme'); - } - $formErrors[$fieldName] = implode(', ', $errorsRaw); - } - } - - $response['status'] = 'validation'; - $response['errors'] = $formErrors; - - return json_encode($response); - } -} diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php deleted file mode 100644 index 9b78065f..00000000 --- a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php +++ /dev/null @@ -1,67 +0,0 @@ -, 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 TYPO3\CMS\Extbase\Mvc\Controller\ActionController; - -class GroupsPriceController extends ActionController -{ - public function indexAction(Hotel $hotel) - { - // Sort configs by date to properly determine earliest date in js component - $configs = $hotel->getGroupsPriceConfigs()->toArray(); - uasort($configs, function ($a, $b) { - return $a->getDateFrom() > $b->getDateFrom(); - }); - - $mainSeasonFrom = $mainSeasonTo = null; - - if (null !== $hotel->getMainSeasonFrom()) { - $mainSeasonFrom = $hotel->getMainSeasonFrom()->format('d.m.Y'); - } - if (null !== $hotel->getMainSeasonTo()) { - $mainSeasonTo = $hotel->getMainSeasonTo()->format('d.m.Y'); - } - - $this->view->assign('hotel', $hotel); - $this->view->assign('runningCostsEUR', $this->settings['runningCostsEUR']); - $this->view->assign('runningCostsCHF', $this->settings['runningCostsCHF']); - $this->view->assign('undersubscription30EUR', $this->settings['undersubscription30EUR']); - $this->view->assign('undersubscription30CHF', $this->settings['undersubscription30CHF']); - $this->view->assign('undersubscription40EUR', $this->settings['undersubscription40EUR']); - $this->view->assign('undersubscription40CHF', $this->settings['undersubscription40CHF']); - $this->view->assign('countryCode', $hotel->getCountry()->getCode()); - $this->view->assign('configs', json_encode(array_values($configs), JSON_HEX_APOS)); - $this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray(), JSON_HEX_APOS)); - $this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray(), JSON_HEX_APOS)); - $this->view->assign('mainSeasonFrom', $mainSeasonFrom); - $this->view->assign('mainSeasonTo', $mainSeasonTo); - $this->view->assign('adolescentsAge', $hotel->getGroupsPriceAdolescentsAge() ?? 0); - } -} diff --git a/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_groups_price_calculator.xml b/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_groups_price_calculator.xml deleted file mode 100644 index f8c607c3..00000000 --- a/public/typo3conf/ext/ep_products/Configuration/FlexForms/flexform_groups_price_calculator.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - 1 - - - - - - Konfiguration - - array - - - - 0 - - - input - 2.5 - double2,required - - - - - - 0 - - - input - 2.9 - double2,required - - - - - - 0 - - - input - 5.0 - double2,required - - - - - - 0 - - - input - 5.0 - double2,required - - - - - - 0 - - - input - 2.5 - double2,required - - - - - - 0 - - - input - 2.5 - double2,required - - - - - - - - diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/Overrides/tt_content.php b/public/typo3conf/ext/ep_products/Configuration/TCA/Overrides/tt_content.php index 45e7dcb5..a4ebb413 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/Overrides/tt_content.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/Overrides/tt_content.php @@ -83,12 +83,6 @@ call_user_func(function () { 'Hotel: Details' ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'EP.EpProducts', - 'hotel_groups_price', - 'Hotel: Preiskalulator Gruppen' - ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'EP.EpProducts', 'hotel_detail_event', @@ -274,10 +268,4 @@ call_user_func(function () { 'FILE:EXT:ep_products/Configuration/FlexForms/flexform_teammembers.xml' ); - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['epproducts_hotel_groups_price'] = 'pi_flexform'; - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( - 'epproducts_hotel_groups_price', - 'FILE:EXT:ep_products/Configuration/FlexForms/flexform_groups_price_calculator.xml' - ); - }); diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index d38b95f1..c7c90b4c 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -149,14 +149,6 @@ $boot = function () { ] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'EP.ep_products', - 'hotel_groups_price', - [ - 'GroupsPrice' => 'index', - ] - ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'EP.ep_products', 'hotel_detail_event', @@ -278,7 +270,6 @@ $boot = function () { 'AjaxTable' => 'datestable,pricetable,pricetableHtml,eventPricetable,daytripRooms', 'AjaxCalendar' => 'range,priceConfig,priceCalendar,priceTable', 'AjaxWatchlist' => 'list', - 'AjaxGroupsPrice' => 'processForm', 'AjaxTeaserPopup' => 'concept', ], [ @@ -289,7 +280,6 @@ $boot = function () { 'AjaxTable' => 'datestable,pricetable,pricetableHtml,eventPricetable,daytripRooms', 'AjaxCalendar' => 'range,priceConfig,priceCalendar,priceTable', 'AjaxWatchlist' => 'list', - 'AjaxGroupsPrice' => 'processForm', 'AjaxTeaserPopup' => 'concept', ] );