Can now save Network Roles

This commit is contained in:
Frank Schubert
2021-07-01 22:40:39 +02:00
parent fc9064ea91
commit dd8db7904d
8 changed files with 242 additions and 134 deletions

View File

@@ -19,6 +19,16 @@ class NetworkAddressModel {
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
@@ -85,7 +95,8 @@ class NetworkAddressModel {
private function getSqlFilter($filter) {
$where = "1=1 ";
$db = FronkDB::singleton();
//var_dump($filter);exit;
if(array_key_exists("network_id", $filter)) {
$network_id = $filter['network_id'];
@@ -101,6 +112,22 @@ class NetworkAddressModel {
}
}
if(is_array($filter['addresstype']) && count($filter['addresstype'])) {
$at = $filter['addresstype'];
$in = [];
foreach(TT_ROLES as $role) {
if(in_array($role, $at)) {
$in[] = "NetworkAddress.type = '$role'";
}
}
$or = "";
if(count($in)) {
$or = implode(" OR ", $in);
$where .= " AND ( $or )";
}
}
//var_dump($filter, $where);exit;
return $where;
}