ADB: Added stiege as part of Hausnummer

This commit is contained in:
Frank Schubert
2024-05-16 15:47:41 +02:00
parent 58ffea17a4
commit 29459e9cca
13 changed files with 111 additions and 36 deletions
+10 -6
View File
@@ -451,6 +451,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'district' => $data->ortschaft,
'street' => $data->strasse,
'housenumber' => $housenumber,
'stiege' => $data->hausnummer_stiege,
'lot_number' => $data->grund_nr,
'meridian' => $data->meridian,
'rw' => $data->rw,
@@ -475,7 +476,6 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'oaid' => $data->wohneinheit_oaid,
'num' => (int)$data->num,
'block' => $data->block,
'stiege' => $data->stiege,
'stock' => $data->stock,
'tuer' => $data->tuer,
'zusatz' => $data->zusatz,
@@ -593,6 +593,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$new_address['cluster_id'] = $ta['cluster_id'];
$new_address['street'] = $ta['street'];
$new_address['housenumber'] = $ta['housenumber'];
$new_address['stiege'] = $ta['stiege'];
$new_address['zip'] = $ta['zip'];
$new_address['city'] = $ta['city'];
if(array_key_exists("municipality", $ta)) {
@@ -606,7 +607,6 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$new_address['building_unit_count'] = $ta['building_unit_count'];
$new_address['num'] = $u['num'];
$new_address['block'] = $u['block'];
$new_address['stiege'] = $u['stiege'];
$new_address['stock'] = $u['stock'];
$new_address['tuer'] = $u['tuer'];
$new_address['zusatz'] = $u['zusatz'];
@@ -637,6 +637,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$search_district = $this->db()->escape(trim($get['district']));
$search_city = $this->db()->escape(trim($get['city']));
$search_housenumber = $this->db()->escape(trim($get['housenumber']));
$search_stiege = $this->db()->escape(trim($get['stiege']));
$format = "flat";
if($get['format'] == "tree") {
@@ -670,7 +671,10 @@ class AddressdbApicontroller extends mfBaseApicontroller {
if($search_housenumber && $search_housenumber != "%") {
$where .= " AND Hausnummer.hausnummer like '$search_housenumber%'";
}
if($search_stiege && $search_stiege != "%") {
$where .= " AND Hausnummer.stiege like '$search_stiege%'";
}
if(count($this->filter_salescluster_ids)) {
$where .= " AND Hausnummer.netzgebiet_id IN (".implode(",", $this->filter_salescluster_ids).")";
}
@@ -682,7 +686,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
//var_dump($this->filter_salescluster_ids);exit;
$sql = AddressDB::$wohneinheit_query;
$sql .= "\n WHERE $where ORDER BY plz, gemeinde, ortschaft, strasse, LENGTH(hausnummer), hausnummer, `Wohneinheit`.block, `Wohneinheit`.stiege, `Wohneinheit`.stock, LENGTH(num), num, LENGTH(`Wohneinheit`.tuer), `Wohneinheit`.tuer";
$sql .= "\n WHERE $where ORDER BY plz, gemeinde, ortschaft, strasse, LENGTH(hausnummer), hausnummer, LENGTH(hausnummer_stiege), hausnummer_stiege, `Wohneinheit`.block, `Wohneinheit`.stock, LENGTH(num), num, LENGTH(`Wohneinheit`.tuer), `Wohneinheit`.tuer";
//$sql = "SELECT * FROM view_wohneinheit WHERE $where ORDER BY plz, gemeinde, ortschaft, strasse, LENGTH(hausnummer), hausnummer, block, stiege, stock, LENGTH(num), num, LENGTH(tuer), tuer";
$this->log->debug($sql);
@@ -736,6 +740,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'district' => $data->ortschaft,
'street' => $data->strasse,
'housenumber' => $housenumber,
'stiege' => $data->hausnummer_stiege,
'lot_number' => $data->grund_nr,
'meridian' => $data->meridian,
'rw' => $data->rw,
@@ -761,7 +766,6 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'oaid' => $data->wohneinheit_oaid,
'num' => (int)$data->num,
'block' => $data->block,
'stiege' => $data->stiege,
'stock' => $data->stock,
'tuer' => $data->tuer,
'zusatz' => $data->zusatz,
@@ -801,6 +805,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$new_address['cluster_id'] = $ta['cluster_id'];
$new_address['street'] = $ta['street'];
$new_address['housenumber'] = $ta['housenumber'];
$new_address['stiege'] = $ta['stiege'];
$new_address['zip'] = $ta['zip'];
$new_address['city'] = $ta['city'];
if(array_key_exists("municipality", $ta)) {
@@ -814,7 +819,6 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$new_address['building_unit_count'] = $ta['building_unit_count'];
$new_address['num'] = $u['num'];
$new_address['block'] = $u['block'];
$new_address['stiege'] = $u['stiege'];
$new_address['stock'] = $u['stock'];
$new_address['tuer'] = $u['tuer'];
$new_address['zusatz'] = $u['zusatz'];
+4 -3
View File
@@ -374,6 +374,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
$address_search_fields = [
'street' => 'strasse',
'housenumber' => "hausnummer",
'stiege' => "hausnummer_stiege",
'zip' => "plz"
];
if($this->district_is_city) {
@@ -398,7 +399,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
}
$unit_search = [];
foreach(['block','stiege','stock','tuer','unit_string'] as $key) {
foreach(['block','stock','tuer','unit_string'] as $key) {
if(property_exists($this->post['address'], $key) && trim($this->post['address']->$key)) {
$unit_search[$key] = trim($this->post['address']->$key);
}
@@ -406,7 +407,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
// ignore unit_string if the specific fields were provided
if($unit_search['block'] || $unit_search['stiege'] || $unit_search['stock'] || $unit_search['tuer']) {
if($unit_search['block'] || $unit_search['stock'] || $unit_search['tuer']) {
unset($unit_search['unit_string']);
}
@@ -569,7 +570,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
// if all unit values are empty try to find the unit with all empty values
// failure is not an error, but must be checked by a human at some point
$where = "hausnummer_id=".$address->hausnummer_id." AND (block = '' OR block IS NULL) AND (stiege = '' OR stiege IS NULL) AND (stock = '' OR stock IS NULL) AND (tuer = '' OR tuer IS NULL) AND (bezeichner = '' OR bezeichner IS NULL)";
$where = "hausnummer_id=".$address->hausnummer_id." AND (block = '' OR block IS NULL) AND (stock = '' OR stock IS NULL) AND (tuer = '' OR tuer IS NULL) AND (bezeichner = '' OR bezeichner IS NULL)";
if($zusatz) {
$where .= " AND zusatz='$zusatz'";
} else {