Added Role view to Network
This commit is contained in:
@@ -65,7 +65,29 @@ class AddresstypeModel {
|
||||
|
||||
}
|
||||
|
||||
public static function search($filter) {
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
$log = mfLoghandler::singleton();
|
||||
$log->debug(print_r($filter,true));
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Addresstype.* FROM Addresstype
|
||||
WHERE $where
|
||||
ORDER BY address_id ASC, `primary` DESC, type ASC";
|
||||
$log->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new NetworkAddress($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter, $indexByType = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
@@ -73,11 +95,15 @@ class AddresstypeModel {
|
||||
$sql = "SELECT Addresstype.* FROM Addresstype
|
||||
WHERE $where
|
||||
ORDER BY address_id ASC, `primary` DESC, type ASC";
|
||||
//var_dump($sql);
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->type] = new Addresstype($data);
|
||||
while($data = $db->fetch_object($res)) {
|
||||
if($indexByType) {
|
||||
$items[$data->type] = new Addresstype($data);
|
||||
} else {
|
||||
$items[] = new Addresstype($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
@@ -99,7 +125,7 @@ class AddresstypeModel {
|
||||
$in[] = "Addresstype.type = 'netowner'";
|
||||
}
|
||||
if(in_array("salespartner", $at)) {
|
||||
$in[] = "Addresstype.type = 'Addresstype'";
|
||||
$in[] = "Addresstype.type = 'salespartner'";
|
||||
}
|
||||
if(in_array("pipeworker", $at)) {
|
||||
$in[] = "Addresstype.type = 'pipeworker'";
|
||||
@@ -107,6 +133,12 @@ class AddresstypeModel {
|
||||
if(in_array("lineworker", $at)) {
|
||||
$in[] = "Addresstype.type = 'lineworker'";
|
||||
}
|
||||
if(in_array("pipeplanner", $at)) {
|
||||
$in[] = "Addresstype.type = 'pipeplanner'";
|
||||
}
|
||||
if(in_array("lineplanner", $at)) {
|
||||
$in[] = "Addresstype.type = 'lineplanner'";
|
||||
}
|
||||
if(in_array("netoperator", $at)) {
|
||||
$in[] = "Addresstype.type = 'netoperator'";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user