diff --git a/web/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/web/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index bf65a612..61569e75 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -88,6 +88,13 @@ class DateImportService implements SingletonInterface */ protected $cacheService; + /** + * @var array + */ + static protected $cache = [ + 'datesAdded' => [], + ]; + /** * @param ConfigurationManagerInterface $configurationManager * @param CacheService $cacheService @@ -272,7 +279,16 @@ class DateImportService implements SingletonInterface $dateCount = 0; foreach ($xmlDate->hotel as $xmlHotel) { + $hotelCode = (string) $xmlHotel->attributes()['code']; $date = $this->createDateRecord($product, $xmlDate); + $key = $hotelCode . $date['date_start']; + + // Import daytrip dates only once per hotel as room information is taken + // from contingents + if ($product['daytrip'] && \in_array($key, static::$cache['datesAdded'], true)) { + continue; + } + if ($this->parseHotel($xmlHotel, $date) !== false) { $this->db->insert( 'tx_epproducts_domain_model_date_temp', @@ -286,6 +302,8 @@ class DateImportService implements SingletonInterface ); $dateCount++; } + + static::$cache['datesAdded'][] = $key; } $this->db->update( 'tx_epproducts_domain_model_product',