From f6e8616783d75675324fdd3cdff2389a97735cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 31 May 2023 14:14:19 +0200 Subject: [PATCH] Feat: Trim value from XML attribute to avoid matching issues --- .../ext/ep_products/Classes/Service/DateImportService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index 481262e0..c1002e8b 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -535,7 +535,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface $count = 0; foreach ($xmlHotel->xpath('zimmer/preis') as $roomXml) { - $code = (string) $roomXml->attributes()['zimmercode']; + $code = trim((string) $roomXml->attributes()['zimmercode']); if ($code === static::CODE_PSEUDOPRICE) { $price = (int) $roomXml->attributes()['preis']; @@ -733,10 +733,11 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface protected function getRoomMappings(): void { - $sql = 'SELECT code, type FROM tx_epproducts_domain_model_roommapping'; + $sql = 'SELECT code, type FROM tx_epproducts_domain_model_roommapping WHERE deleted = 0 AND hidden = 0'; $roomMappings = $this->db->fetchAllAssociative($sql); foreach ($roomMappings as $mapping) { - $this->roomMappings[mb_strtolower($mapping['code'])] = $mapping['type']; + $key = trim(mb_strtolower($mapping['code'])); + $this->roomMappings[$key] = $mapping['type']; } }