Various Bugfixes
This commit is contained in:
@@ -198,25 +198,25 @@ class BuildingController extends mfBaseController {
|
||||
$data['lineworker_id'] = ($r->lineworker_id) ? $r->lineworker_id : null;
|
||||
$data['networksection_id'] = ($r->networksection_id) ? $r->networksection_id : null;
|
||||
|
||||
$data['oan_id'] = $r->oan_id;
|
||||
$data['street'] = $r->street;
|
||||
$data['zip'] = $r->zip;
|
||||
$data['city'] = $r->city;
|
||||
$data['oan_id'] = trim($r->oan_id);
|
||||
$data['street'] = trim($r->street);
|
||||
$data['zip'] = trim($r->zip);
|
||||
$data['city'] = trim($r->city);
|
||||
|
||||
$data['contact'] = $r->contact;
|
||||
$data['phone'] = $r->phone;
|
||||
$data['email'] = $r->email;
|
||||
$data['units'] = $r->units;
|
||||
$data['description'] = $r->description;
|
||||
$data['note'] = $r->note;
|
||||
$data['contact'] = trim($r->contact);
|
||||
$data['phone'] = trim($r->phone);
|
||||
$data['email'] = trim($r->email);
|
||||
$data['units'] = trim($r->units);
|
||||
$data['description'] = trim($r->description);
|
||||
$data['note'] = trim($r->note);
|
||||
|
||||
$data['edit_by'] = 1;
|
||||
|
||||
if($this->me->is("Admin")) {
|
||||
if($r->gps_lat) $data['gps_lat'] = $r->gps_lat;
|
||||
if($r->gps_long) $data['gps_long'] = $r->gps_long;
|
||||
if($r->code) $data['code'] = $r->code;
|
||||
if($r->laea) $data['laea'] = $r->laea;
|
||||
if($r->gps_lat) $data['gps_lat'] = trim($r->gps_lat);
|
||||
if($r->gps_long) $data['gps_long'] = trim($r->gps_long);
|
||||
if($r->code) $data['code'] = trim($r->code);
|
||||
if($r->laea) $data['laea'] = trim($r->laea);
|
||||
}
|
||||
|
||||
if($mode == "add") {
|
||||
@@ -224,13 +224,13 @@ class BuildingController extends mfBaseController {
|
||||
$building = BuildingModel::create($data);
|
||||
|
||||
// check if building exists already
|
||||
$checkBuilding = BuildingModel::search(['street' => $data['street'], 'city' => $data['city'], 'zip' => $data['zip']]);
|
||||
$checkBuilding = BuildingModel::search(['=street' => $data['street'], '=city' => $data['city'], '=zip' => $data['zip']]);
|
||||
|
||||
if($checkBuilding) {
|
||||
$this->layout()->setFlash("Objekt ist <a target='_blank' href='".self::getUrl("Building")."#building=".$checkBuilding[0]->id."'>bereits vorhanden</a>!", "error");
|
||||
$this->layout()->set("building", $building);
|
||||
return $this->add();
|
||||
}
|
||||
|
||||
} else {
|
||||
$building->update($data);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ class BuildingModel {
|
||||
LEFT JOIN Buildingstatus ON (Buildingstatus.id = Building.status_id)
|
||||
WHERE $where
|
||||
ORDER BY network_id, pop_id, street, zip, city";
|
||||
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
@@ -215,6 +216,13 @@ class BuildingModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("=street", $filter)) {
|
||||
$street = FronkDB::singleton()->escape($filter["=street"]);
|
||||
if($street) {
|
||||
$where .= " AND street like '$street'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("zip", $filter)) {
|
||||
$zip = FronkDB::singleton()->escape($filter["zip"]);
|
||||
if($zip) {
|
||||
@@ -222,6 +230,13 @@ class BuildingModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("=zip", $filter)) {
|
||||
$zip = FronkDB::singleton()->escape($filter["=zip"]);
|
||||
if($zip) {
|
||||
$where .= " AND zip like '$zip'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("city", $filter)) {
|
||||
$city = FronkDB::singleton()->escape($filter["city"]);
|
||||
if($city) {
|
||||
@@ -229,6 +244,13 @@ class BuildingModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("=city", $filter)) {
|
||||
$city = FronkDB::singleton()->escape($filter["=city"]);
|
||||
if($city) {
|
||||
$where .= " AND city like '$city'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user