Merge branch 'fronkdev' into 'master'

Fixed always looking for empty string in stiege in submitPreorder()

See merge request fronk/thetool!373
This commit is contained in:
Frank Schubert
2024-05-17 14:17:16 +00:00

View File

@@ -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'";
}