From eeb26aaa6fb4010fcbe34decbf3efc8c42995d1c Mon Sep 17 00:00:00 2001 From: marc tobias Date: Wed, 30 Oct 2019 18:49:02 +0100 Subject: [PATCH] Addresses with housenumber 0 are found --- lib/AddressDetails.php | 9 +++++---- lib/SearchDescription.php | 4 ++-- lib/template/details-html.php | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/AddressDetails.php b/lib/AddressDetails.php index 783a0fda..61823b4c 100644 --- a/lib/AddressDetails.php +++ b/lib/AddressDetails.php @@ -76,14 +76,14 @@ class AddressDetails $bFallback = true; } - $sName = false; - if (isset($aLine['localname']) && $aLine['localname']) { + $sName = null; + if (isset($aLine['localname']) && $aLine['localname']!=='') { $sName = $aLine['localname']; - } elseif (isset($aLine['housenumber']) && $aLine['housenumber']) { + } elseif (isset($aLine['housenumber']) && $aLine['housenumber']!=='') { $sName = $aLine['housenumber']; } - if ($sName) { + if (isset($sName)) { $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel']) ? $aTypeLabel['simplelabel'] : $aTypeLabel['label']); $sTypeLabel = str_replace(' ', '_', $sTypeLabel); if (!isset($aAddress[$sTypeLabel]) @@ -97,6 +97,7 @@ class AddressDetails } } } + return $aAddress; } diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 506d4202..4fafbec2 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -447,8 +447,8 @@ class SearchDescription $iLimit ); - //now search for housenumber, if housenumber provided - if ($this->sHouseNumber && !empty($aResults)) { + // Now search for housenumber, if housenumber provided. Can be zero. + if (($this->sHouseNumber || $this->sHouseNumber === '0') && !empty($aResults)) { // Downgrade the rank of the street results, they are missing // the housenumber. foreach ($aResults as $oRes) { diff --git a/lib/template/details-html.php b/lib/template/details-html.php index 9b76efc1..cfba6eb3 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -64,7 +64,7 @@ $bNotUsed = isset($aAddressLine['isaddress']) && !$aAddressLine['isaddress']; echo ''."\n"; - echo ' '.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name')."\n"; + echo ' '.(trim($aAddressLine['localname'])!==null?$aAddressLine['localname']:'No Name')."\n"; echo ' ' . $aAddressLine['class'].':'.$aAddressLine['type'] . "\n"; echo ' ' . osmLink($aAddressLine) . "\n"; echo ' ' . (isset($aAddressLine['rank_address']) ? $aAddressLine['rank_address'] : '') . "\n"; -- 2.39.5