From 80e4921b4695c22521b4a80d1f2230bfd00fe2a8 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Fri, 17 May 2024 16:16:29 +0200 Subject: [PATCH] Fixed always looking for empty string in stiege in submitPreorder() --- application/Api/v1/PreorderApicontroller.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/application/Api/v1/PreorderApicontroller.php b/application/Api/v1/PreorderApicontroller.php index 4c157af1b..5a2a21ebc 100644 --- a/application/Api/v1/PreorderApicontroller.php +++ b/application/Api/v1/PreorderApicontroller.php @@ -422,7 +422,6 @@ class PreorderApicontroller extends mfBaseApicontroller { $address_search_fields = [ 'street' => 'strasse', 'housenumber' => "hausnummer", - 'stiege' => "hausnummer_stiege", 'zip' => "plz" ]; if($this->district_is_city) { @@ -436,6 +435,12 @@ class PreorderApicontroller extends mfBaseApicontroller { $address_search[$field_name] = $this->db()->escape(trim($this->post['address']->$key)); } } + + if(property_exists($this->post['address'], "stiege") && trim($this->post['address']->stiege)) { + $address_search["hausnummer_stiege"] = $this->db()->escape(trim($this->post['address']->stiege)); + } else { + $address_search["hausnummer_stiege"] = null; + } $zusatz = false; if($this->hausnummer_add_zusatz) { @@ -511,6 +516,10 @@ class PreorderApicontroller extends mfBaseApicontroller { $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; + } $where .= " AND `$field` = '$value'"; }