ADB: Added stiege as part of Hausnummer
This commit is contained in:
@@ -49,6 +49,9 @@ class ADBHausnummer extends mfBaseModel {
|
||||
$address .= " ".$this->getProperty("ortschaft")->name.",";
|
||||
$address .= " ".$this->getProperty("strasse")->name;
|
||||
$address .= " ".$this->hausnummer;
|
||||
if($this->stiege) {
|
||||
$address .= "/".$this->stiege;
|
||||
}
|
||||
return $address;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ class ADBHausnummerModel {
|
||||
public $plz_id;
|
||||
public $strasse_id;
|
||||
public $hausnummer;
|
||||
public $stiege;
|
||||
public $zusatz;
|
||||
public $grund_nr;
|
||||
public $gdaeigenschaft;
|
||||
@@ -338,6 +339,13 @@ class ADBHausnummerModel {
|
||||
$where .= " AND Hausnummer.`hausnummer` like '$hausnummer%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("stiege", $filter)) {
|
||||
$stiege = FronkDB::singleton()->escape($filter['stiege']);
|
||||
if($stiege) {
|
||||
$where .= " AND stiege.name = '$stiege'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("strasse", $filter)) {
|
||||
$strasse = FronkDB::singleton()->escape($filter['strasse']);
|
||||
|
||||
@@ -26,6 +26,7 @@ class AddressDB {
|
||||
`Hausnummer`.`subcd` AS `subcd`,
|
||||
`Hausnummer`.`oaid` AS `hausnummer_oaid`,
|
||||
`Hausnummer`.`hausnummer` AS `hausnummer`,
|
||||
`Hausnummer`.`stiege` AS `hausnummer_stiege`,
|
||||
`Hausnummer`.`extref` AS `hausnummer_extref`,
|
||||
`Hausnummer`.`unit_count` AS `unit_count`,
|
||||
`Hausnummer`.`meridian` AS `meridian`,
|
||||
@@ -95,7 +96,7 @@ class AddressDB {
|
||||
if($netzgebiet_id) {
|
||||
$res = $this->db->query("SELECT rimo_fcp_name FROM `Hausnummer` WHERE netzgebiet_id=$netzgebiet_id GROUP BY rimo_fcp_name ORDER BY LENGTH(rimo_fcp_name), rimo_fcp_name");
|
||||
} else {
|
||||
$res = $this->db->query("SELECT rimo_fcp_name FROM `Hausnummer` WHERE GROUP BY rimo_fcp_name ORDER BY rimo_fcp_name");
|
||||
$res = $this->db->query("SELECT rimo_fcp_name FROM `Hausnummer` GROUP BY rimo_fcp_name ORDER BY LENGTH(rimo_fcp_name), rimo_fcp_name");
|
||||
}
|
||||
if($this->db->num_rows($res)) {
|
||||
while($data = $this->db->fetch_object($res)) {
|
||||
@@ -257,6 +258,7 @@ class AddressDB {
|
||||
$hausnummer_data['plz_id'] = $plz->id;
|
||||
$hausnummer_data['strasse_id'] = $strasse->id;
|
||||
$hausnummer_data['hausnummer'] = $data['hausnummer'];
|
||||
$hausnummer_data['stiege'] = $data['stiege'];
|
||||
$hausnummer_data['grund_nr'] = $data['grund_nr'];
|
||||
$hausnummer_data['gdaeigenschaft'] = $data['gdaeigenschaft'];
|
||||
$hausnummer_data['meridian'] = $data['meridian'];
|
||||
|
||||
@@ -270,7 +270,7 @@ class AddressDBController extends mfBaseController {
|
||||
if(!$this->me->is("Admin")) {
|
||||
$required[] = "netzgebiet_id";
|
||||
}
|
||||
foreach(['adrcd','extref','rimo_id','netzgebiet_id','strasse','hausnummer','plz','ortschaft','gemeinde','grund_nr','gdaeigenschaft','meridian','rw','hw','gps_lat','gps_long','unit_count','visibility'] as $field) {
|
||||
foreach(['adrcd','extref','rimo_id','netzgebiet_id','strasse','hausnummer','stiege','plz','ortschaft','gemeinde','grund_nr','gdaeigenschaft','meridian','rw','hw','gps_lat','gps_long','unit_count','visibility'] as $field) {
|
||||
if(in_array($field, $required)) {
|
||||
if(!trim($r->$field)) {
|
||||
$this->layout()->setFlash("'".ucfirst($field)."' darf nicht leer sein!", "error");
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -530,13 +530,14 @@ class Preorder extends mfBaseModel {
|
||||
$address['cluster_id'] = $hausnummer->netzgebiet->extref;
|
||||
$address['street'] = $hausnummer->strasse->name;
|
||||
$address['housenumber'] = $hausnummer->hausnummer;
|
||||
$address['stiege'] = $hausnummer->stiege;
|
||||
$address['zip'] = $hausnummer->plz->plz;
|
||||
$address['city'] = $hausnummer->strasse->gemeinde->name;
|
||||
$address['municipality'] = "";
|
||||
$address['district'] = $hausnummer->ortschaft->name;
|
||||
$address['block'] = ($wohneinheit->block) ? $wohneinheit->block : null;
|
||||
$address['stock'] = ($wohneinheit->stock) ? $wohneinheit->stock : null;
|
||||
$address['stiege'] = ($wohneinheit->stiege) ? $wohneinheit->stiege : null;
|
||||
//$address['stiege'] = ($wohneinheit->stiege) ? $wohneinheit->stiege : null;
|
||||
$address['tuer'] = ($wohneinheit->tuer) ? $wohneinheit->tuer : null;
|
||||
$address['unit_string'] = ($wohneinheit->bezeichner) ? $wohneinheit->bezeichner : null;
|
||||
$address['is_shipping'] = ($this->shipping_address == "address") ? true : false;
|
||||
@@ -554,12 +555,12 @@ class Preorder extends mfBaseModel {
|
||||
$customer['firstnam'] = ($this->firstname) ? $this->firstname : null;
|
||||
$customer['lastname'] = ($this->lastname) ? $this->lastname : null;
|
||||
$customer['street'] = ($this->street) ? $this->street : null;
|
||||
$customer['stiege'] = ($this->stiege) ? $this->stiege : null;
|
||||
$customer['housenumber'] = ($this->housenumber) ? $this->housenumber : null;
|
||||
$customer['zip'] = ($this->zip) ? $this->zip : null;
|
||||
$customer['city'] = ($this->city) ? $this->city : null;
|
||||
$customer['block'] = ($this->block) ? $this->block : null;
|
||||
$customer['stock'] = ($this->stock) ? $this->stock : null;
|
||||
$customer['stiege'] = ($this->stiege) ? $this->stiege : null;
|
||||
$customer['tuer'] = ($this->tuer) ? $this->tuer : null;
|
||||
$customer['unit_string'] = ($this->unit_string) ? $this->unit_string : null;
|
||||
$customer['phone'] = ($this->phone) ? $this->phone : null;
|
||||
|
||||
@@ -730,6 +730,13 @@ class PreorderModel {
|
||||
$where .= " AND adb_hausnummer.hausnummer like '%$hausnummer%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("stiege", $filter)) {
|
||||
$stiege = FronkDB::singleton()->escape($filter['stiege']);
|
||||
if($stiege) {
|
||||
$where .= " AND adb_hausnummer.stiege like '%$stiege%'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("unit_count", $filter)) {
|
||||
$unit_count = $filter['unit_count'];
|
||||
|
||||
Reference in New Issue
Block a user