From baf610ab28da7a33c13a820fa6b31dd2787baa7b Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 12 Mar 2025 15:01:49 +0100 Subject: [PATCH] Rimo Import: Now trimming certain stringified control characters from strings --- .../ADBAddressHelper/address_helper.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/adb-rimo-import/ADBAddressHelper/address_helper.php b/scripts/adb-rimo-import/ADBAddressHelper/address_helper.php index dfaa0fec4..a4baa9e17 100644 --- a/scripts/adb-rimo-import/ADBAddressHelper/address_helper.php +++ b/scripts/adb-rimo-import/ADBAddressHelper/address_helper.php @@ -135,8 +135,8 @@ class AddressHelper } - $name = trim($building->name); - $strasse_hausnummer = trim($building->address->name); + $name = $this->trimExtra($building->name); + $strasse_hausnummer = trim($this->trimExtra($building->address->name)); $split_result = $this->splitStreetHausnummer($strasse_hausnummer); if (!$split_result) { @@ -148,18 +148,18 @@ class AddressHelper $hausnummer_name = $this->db->escape($split_result[1]); $addresszusatz = $this->db->escape($split_result[2]); - $gem_kz = $this->db->escape(trim($building->municipality->name)); - $gem_name = $this->db->escape(trim($building->municipality->userLabel)); + $gem_kz = $this->db->escape($this->trimExtra($building->municipality->name)); + $gem_name = $this->db->escape($this->trimExtra($building->municipality->userLabel)); - $ort_name = $this->db->escape(trim($building->address->city)); - $plz_name = $this->db->escape(trim($building->address->zipCode)); + $ort_name = $this->db->escape($this->trimExtra($building->address->city)); + $plz_name = $this->db->escape($this->trimExtra($building->address->zipCode)); $lat = ($building->address->latitude) ? $this->truncateFloat($building->address->latitude, 14) : null; $long = ($building->address->longitude) ? $this->truncateFloat($building->address->longitude, 14) : null; //$lat = $building->address->latitude; //$long = $building->address->longitude; $unit_count = $building->homesCount; - $lot_num = $building->address->lotNumber; + $lot_num = $this->trimExtra($building->address->lotNumber); $fcp_name = false; $adrcd = false; @@ -551,4 +551,7 @@ class AddressHelper echo $logtext . "\n"; } + public function trimExtra($string) { + return preg_replace(['/\\\r+/', '/\\\n+/', '/\\\t+/'], "", trim($string)); + } } \ No newline at end of file