Merge branch 'fronkdev' into 'master'

Fixed Stiege issue in "ortschaft strasse" query

See merge request fronk/thetool!378
This commit is contained in:
Frank Schubert
2024-05-23 11:31:16 +00:00

View File

@@ -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'];