Fix xml-import using incorrect attribute

This commit is contained in:
Björn Fromme
2021-07-27 14:05:57 +02:00
parent 5936538f2a
commit a6834e0e8c
2 changed files with 19 additions and 10 deletions
@@ -240,14 +240,14 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
$dateCount = 0; $dateCount = 0;
$sql = ' $sql = '
SELECT p.uid uid, p.daytrip daytrip, p.hide_booking_button, p.important important, p.name product_name, 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.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.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, 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, 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, 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 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_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_region r ON p.region = r.uid
INNER JOIN tx_epproducts_domain_model_city c ON p.city = c.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) foreach ($selectionGroup as $selection)
{ {
$attributes = $selection->attributes(); $attributes = $selection->attributes();
$id = (int) $attributes['id']; $id = (int) $attributes['idbuspro'];
$data[$id] = (string) $attributes['bezeichnung']; $data[$id] = (string) $attributes['bezeichnung'];
} }
@@ -767,7 +767,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
protected function getHotelMappings() protected function getHotelMappings()
{ {
$sql = ' $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.earlybird earlybird, h.new new, h.low_contingent low_contingent,
h.keywords keywords, h.header_title header_title, h.keywords keywords, h.header_title header_title,
h.category category, h.teaser teaser, h.detail_page detail_page 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 FROM tx_epproducts_domain_model_matchcode matchcode
WHERE matchcode.deleted = 0 AND matchcode.hidden = 0 WHERE matchcode.deleted = 0 AND matchcode.hidden = 0
ORDER BY code ORDER BY code
) u ) u
LEFT JOIN tx_epproducts_domain_model_hotel h ON u.uid = h.uid LEFT JOIN tx_epproducts_domain_model_hotel h ON u.uid = h.uid
'; ';
$rows = $this->db->fetchAllAssociative($sql); $rows = $this->db->fetchAllAssociative($sql);
@@ -810,7 +810,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
protected function getTopFactForRecord($table, $uid) protected function getTopFactForRecord($table, $uid)
{ {
$sql = ' $sql = '
SELECT f.name SELECT f.name
FROM ' . $table . ' mm FROM ' . $table . ' mm
INNER JOIN tx_epproducts_domain_model_fact f ON mm.uid_foreign = f.uid INNER JOIN tx_epproducts_domain_model_fact f ON mm.uid_foreign = f.uid
WHERE mm.uid_local = :uid WHERE mm.uid_local = :uid
@@ -15,6 +15,10 @@ class ImportTimestampService
$line = trim(file($lastImportTimestampPath)[0]); $line = trim(file($lastImportTimestampPath)[0]);
if (empty($line)) {
return null;
}
return \DateTime::createFromFormat('d.m.Y H:i:s', $line); return \DateTime::createFromFormat('d.m.Y H:i:s', $line);
} }
@@ -36,6 +40,11 @@ class ImportTimestampService
} }
$line = trim(file($updatedTimestampPath)[0]); $line = trim(file($updatedTimestampPath)[0]);
if (empty($line)) {
return true;
}
$lastUploadAt = \DateTime::createFromFormat('d.m.Y H:i:s', $line); $lastUploadAt = \DateTime::createFromFormat('d.m.Y H:i:s', $line);
$lastImportAt = $this->readImportTimestamp($importTimestampFile); $lastImportAt = $this->readImportTimestamp($importTimestampFile);