From dacc22d33443a1c1a623bc77998913742e556a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 17:30:34 +0200 Subject: [PATCH 1/4] Adopt changed method signature --- .../ep_products/Classes/Controller/AjaxCalendarController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php index 5e32f586..408c8c42 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxCalendarController.php @@ -71,7 +71,7 @@ class AjaxCalendarController extends ActionController $eventsRangeBegin = $range->getBegin()->sub(new \DateInterval('P1D')); $eventsRangeEnd = $range->getEnd()->add(new \DateInterval('P1D')); $eventsRange = new Range($eventsRangeBegin, $eventsRangeEnd); - $events = $factory->getEvents($eventsRange, [ 'hotel' => $hotel ]); + $events = $factory->getEvents($eventsRange, [ 'hotel' => $hotel, 'hotelCode' => $hotel->getCode() ]); $yearStart = $factory->getYear($range->getBegin()->format('Y')); $yearEnd = null; From d9330c2a1730bde528f7015ac2dab8e549a27b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 17:44:03 +0200 Subject: [PATCH 2/4] Fix incorrect update requirement detection --- .../ep_products/Classes/Service/ImportTimestampService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php b/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php index 3fc2844a..9abe9934 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php @@ -30,7 +30,9 @@ class ImportTimestampService $updatedTimestampPath = GeneralUtility::getFileAbsFileName($uploadTimestampFile); if (!$updatedTimestampPath || !file_exists($updatedTimestampPath)) { - return false; + $this->writeImportTimestamp($importTimestampFile); + + return true; } $line = trim(file($updatedTimestampPath)[0]); From b4e7179e8d25193d803f6a1c1c22164003290ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 17:44:20 +0200 Subject: [PATCH 3/4] Add ignored room types --- .../Classes/Service/ContingentImportService.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ContingentImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/ContingentImportService.php index a6562f03..6f16691d 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/ContingentImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/ContingentImportService.php @@ -43,6 +43,11 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac const ROOMCODE_STATUS = 'BelKal'; + /** + * @var string[] + */ + protected $ignoredRoomTypes = ['PDGS', 'TEAM']; + /** * @var ConfigurationManagerInterface */ @@ -240,6 +245,9 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac } $roomType = $roomTypes[$roomTypeBusProId]; $roomCode = $roomType['code']; + if (in_array($roomCode, $this->ignoredRoomTypes, true)) { + continue; + } $availablePax = 0; $capacity = 0; if ($roomType['ctrl'] === true) { @@ -254,9 +262,6 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac $availableRooms = (int) $xmlRoom['frei'] > 0 ? (int) $xmlRoom['frei'] : 0; $availablePax = $availableRooms * $roomType['pax']; } - if ($availablePax === 0 && $roomType['ctrl'] === false) { - //continue; - } $minPrice = (int) $xmlRoom['abpreis']; $minNights = (int) $xmlRoom['abpreis_naechte']; $additionalNightMinPrice = (int) $xmlRoom['abpreis_verlaengerung']; From 244cbd70020154aea877d346f123fb2368b266b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 8 Jun 2021 17:44:33 +0200 Subject: [PATCH 4/4] Add logging --- .../ext/ep_products/Classes/Service/GroupsSwissService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php b/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php index 44d5c1d5..eca91347 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/GroupsSwissService.php @@ -211,6 +211,7 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface */ protected function addItem(array $item, $status, $apiKey, $houseNumber): void { + $this->logger->info(sprintf('Adding status %d in %s-%s for %s', $status, $item['from']->format('Y-m-d'), $item['to']->format('Y-m-d'), $houseNumber)); $url = sprintf( 'http://www.groups.swiss/api/1.0/json.php?apiKey=%s&method=setAvailabilityChart&house=%d&from=%s&till=%s&state=%d', $apiKey, @@ -221,8 +222,7 @@ class GroupsSwissService implements SingletonInterface, LoggerAwareInterface ); try { - $foo = 1; -// $this->httpClient->request('GET', $url); + $this->httpClient->request('GET', $url); } catch (TransportExceptionInterface $e) { $this->logger->error(sprintf('A problem occured: %s', $e->getMessage())); }