From 72c406766c00d15c5204a0b89154a499b8dfdcc5 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 23 May 2024 13:30:16 +0200 Subject: [PATCH] Fixed Stiege issue in "ortschaft strasse" query --- application/Api/v1/PreorderApicontroller.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/application/Api/v1/PreorderApicontroller.php b/application/Api/v1/PreorderApicontroller.php index 5a2a21ebc..290da6580 100644 --- a/application/Api/v1/PreorderApicontroller.php +++ b/application/Api/v1/PreorderApicontroller.php @@ -517,8 +517,8 @@ class PreorderApicontroller extends mfBaseApicontroller { foreach($address_search as $field => $value) { if($field == "ortschaft" || $field == "gemeinde") continue; if($field == "hausnummer_stiege" && !$value) { - $where .= " AND (`hausnummer_stiege` = '' OR hausnummer_stiege IS NULL)"; - continue; + $where .= " AND (`hausnummer_stiege` = '' OR hausnummer_stiege IS NULL)"; + continue; } $where .= " AND `$field` = '$value'"; } @@ -531,11 +531,16 @@ class PreorderApicontroller extends mfBaseApicontroller { $sql = "SELECT * FROM view_hausnummer WHERE $where"; $this->log->debug($sql); $res = $this->db()->query($sql); + + // If not found, try with Ortschaft in front of strasse (liezen gwr issue) if(!$this->db()->num_rows($res)) { - // try with Ortschaft in front of strasse (liezen gwr issue) $where = "1=1 "; foreach($address_search as $field => $value) { if($field == "ortschaft" || $field == "gemeinde") continue; + if($field == "hausnummer_stiege" && !$value) { + $where .= " AND (`hausnummer_stiege` = '' OR hausnummer_stiege IS NULL)"; + continue; + } if($field == "strasse") { $prefix = ($address_search['ortschaft']) ? $address_search['ortschaft'] : $address_search['gemeinde'];