Added filters to Pipework

This commit is contained in:
Frank Schubert
2021-08-30 22:42:38 +02:00
parent b166bc3bd2
commit 609dac71ab
4 changed files with 99 additions and 11 deletions

View File

@@ -110,6 +110,13 @@ class BuildingModel {
}
}
if(array_key_exists("status_id", $filter)) {
$status_id = $filter['status_id'];
if(is_numeric($status_id)) {
$where .= " AND Building.status_id=$status_id";
}
}
if(is_array($filter['type']) && count($filter['type'])) {
$ot = $filter['type'];
$in = [];
@@ -153,28 +160,28 @@ class BuildingModel {
if(array_key_exists("code", $filter)) {
$code = FronkDB::singleton()->escape($filter['code']);
if($code) {
$where .= " AND Building.`code`='$code'";
$where .= " AND Building.`code` like '%$code%'";
}
}
if(array_key_exists("street", $filter)) {
$street = FronkDB::singleton()->escape($filter["street"]);
if($street) {
$where .= " AND street='$street'";
$where .= " AND street like '%$street%'";
}
}
if(array_key_exists("zip", $filter)) {
$zip = FronkDB::singleton()->escape($filter["zip"]);
if($zip) {
$where .= " AND zip='$zip'";
$where .= " AND zip like '%$zip%'";
}
}
if(array_key_exists("city", $filter)) {
$city = FronkDB::singleton()->escape($filter["city"]);
if($city) {
$where .= " AND city='$city'";
$where .= " AND city like '%$city%'";
}
}