Feat: Trim value from XML attribute to avoid matching issues

This commit is contained in:
Björn Fromme
2023-05-31 14:14:19 +02:00
parent e59d547ae2
commit f6e8616783
@@ -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'];
}
}