From a6834e0e8ce74c5bfc5b110852683556a4ffd580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 27 Jul 2021 14:05:57 +0200 Subject: [PATCH] Fix xml-import using incorrect attribute --- .../Classes/Service/DateImportService.php | 20 +++++++++---------- .../Service/ImportTimestampService.php | 9 +++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index 02c7257b..8767d272 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -240,14 +240,14 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface $dateCount = 0; $sql = ' - SELECT p.uid uid, p.daytrip daytrip, p.hide_booking_button, p.important important, p.name product_name, - p.searchable product_searchable, p.detail_page product_detail_page, p.keywords product_keywords, - p.teaser product_teaser, p.feature product_feature, p.subline product_subline, p.country country, + SELECT p.uid uid, p.daytrip daytrip, p.hide_booking_button, p.important important, p.name product_name, + p.searchable product_searchable, p.detail_page product_detail_page, p.keywords product_keywords, + p.teaser product_teaser, p.feature product_feature, p.subline product_subline, p.country country, p.region region, p.city city, p.path_segment slug, p.season season, - cnt.name country_name, cnt.code country_code, cnt.keywords country_keywords, r.name region_name, - r.keywords region_keywords, r.feature region_feature, c.name city_name, c.keywords city_keywords, + cnt.name country_name, cnt.code country_code, cnt.keywords country_keywords, r.name region_name, + r.keywords region_keywords, r.feature region_feature, c.name city_name, c.keywords city_keywords, p.concept concept, con.name concept_name, con.code concept_code, con.sorting concept_sorting - FROM tx_epproducts_domain_model_product p + FROM tx_epproducts_domain_model_product p INNER JOIN tx_epproducts_domain_model_country cnt ON p.country = cnt.uid INNER JOIN tx_epproducts_domain_model_region r ON p.region = r.uid INNER JOIN tx_epproducts_domain_model_city c ON p.city = c.uid @@ -727,7 +727,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface foreach ($selectionGroup as $selection) { $attributes = $selection->attributes(); - $id = (int) $attributes['id']; + $id = (int) $attributes['idbuspro']; $data[$id] = (string) $attributes['bezeichnung']; } @@ -767,7 +767,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface protected function getHotelMappings() { $sql = ' - SELECT u.code code, u.uid uid, h.name name, h.type type, + SELECT u.code code, u.uid uid, h.name name, h.type type, h.earlybird earlybird, h.new new, h.low_contingent low_contingent, h.keywords keywords, h.header_title header_title, h.category category, h.teaser teaser, h.detail_page detail_page @@ -779,7 +779,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface FROM tx_epproducts_domain_model_matchcode matchcode WHERE matchcode.deleted = 0 AND matchcode.hidden = 0 ORDER BY code - ) u + ) u LEFT JOIN tx_epproducts_domain_model_hotel h ON u.uid = h.uid '; $rows = $this->db->fetchAllAssociative($sql); @@ -810,7 +810,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface protected function getTopFactForRecord($table, $uid) { $sql = ' - SELECT f.name + SELECT f.name FROM ' . $table . ' mm INNER JOIN tx_epproducts_domain_model_fact f ON mm.uid_foreign = f.uid WHERE mm.uid_local = :uid diff --git a/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php b/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php index 9abe9934..c3bf1750 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/ImportTimestampService.php @@ -15,6 +15,10 @@ class ImportTimestampService $line = trim(file($lastImportTimestampPath)[0]); + if (empty($line)) { + return null; + } + return \DateTime::createFromFormat('d.m.Y H:i:s', $line); } @@ -36,6 +40,11 @@ class ImportTimestampService } $line = trim(file($updatedTimestampPath)[0]); + + if (empty($line)) { + return true; + } + $lastUploadAt = \DateTime::createFromFormat('d.m.Y H:i:s', $line); $lastImportAt = $this->readImportTimestamp($importTimestampFile);