From c2dc88b8abacbbccb5566213c3ea6aee832a61aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 30 Sep 2026 13:50:04 +0200 Subject: [PATCH] fix: match API whitespace handling and skip matchcodes of hidden hotels --- .../Classes/Service/DateImportService.php | 2 ++ .../Classes/Service/XmlProductReader.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index bd31806d..1cab011e 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -827,7 +827,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface WHERE hotel.code != "" AND hotel.deleted = 0 AND hotel.hidden = 0 UNION SELECT matchcode.code code, matchcode.entity uid FROM tx_epproducts_domain_model_matchcode matchcode + INNER JOIN tx_epproducts_domain_model_hotel matchcode_hotel ON matchcode.entity = matchcode_hotel.uid WHERE matchcode.deleted = 0 AND matchcode.hidden = 0 + AND matchcode_hotel.deleted = 0 AND matchcode_hotel.hidden = 0 ORDER BY code ) u LEFT JOIN tx_epproducts_domain_model_hotel h ON u.uid = h.uid diff --git a/public/typo3conf/ext/ep_products/Classes/Service/XmlProductReader.php b/public/typo3conf/ext/ep_products/Classes/Service/XmlProductReader.php index ce84110e..9e50c21c 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/XmlProductReader.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/XmlProductReader.php @@ -13,7 +13,9 @@ use Psr\Log\NullLogger; * * Nothing is filtered or rewritten here: every display rule stays in * DateImportService. Prices are parsed from the German format, and a price the - * source does not state is null. + * source does not state is null. Like the API, service labels and pickup + * cities and streets are trimmed with inner whitespace collapsed; every other + * text is passed on verbatim. */ final class XmlProductReader implements \IteratorAggregate { @@ -197,7 +199,7 @@ final class XmlProductReader implements \IteratorAggregate $services[] = [ 'busProId' => (int) $xmlService['idbuspro'], 'subType' => (string) $xmlService['unterart'], - 'label' => (string) $xmlService->text, + 'label' => $this->normalizeWhitespace((string) $xmlService->text), 'price' => $this->parsePrice((string) $xmlService->preis), 'status' => (string) $xmlService->status, 'direction' => $direction === '' ? null : $direction, @@ -316,14 +318,19 @@ final class XmlProductReader implements \IteratorAggregate foreach ($xmlData->zustieg as $xmlPickup) { $pickups[(int) $xmlPickup['idbuspro']] = [ 'code' => (string) $xmlPickup['code'], - 'city' => (string) $xmlPickup->ort, - 'street' => (string) $xmlPickup->strasse, + 'city' => $this->normalizeWhitespace((string) $xmlPickup->ort), + 'street' => $this->normalizeWhitespace((string) $xmlPickup->strasse), ]; } return $pickups; } + private function normalizeWhitespace(string $value): string + { + return trim((string) preg_replace('/\s+/u', ' ', $value)); + } + private function parseDate(string $value): ?\DateTimeImmutable { $date = \DateTimeImmutable::createFromFormat('!d.m.Y', trim($value), $this->timezone);