2011-11-29 Sergio Martin <sergio.martin@artica.es>
* include/functions_agents.php: Fixed filter of the operation agents view for bug 3445244 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5207 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c605536b33
commit
c89fe8fa08
|
@ -1,3 +1,8 @@
|
|||
2011-11-29 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_agents.php: Fixed filter of the operation
|
||||
agents view for bug 3445244
|
||||
|
||||
2011-11-29 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_graph.php
|
||||
|
|
|
@ -316,6 +316,21 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
$filter = array ();
|
||||
}
|
||||
|
||||
|
||||
if(isset($filter['offset'])) {
|
||||
$offset = $filter['offset'];
|
||||
unset($filter['offset']);
|
||||
}
|
||||
|
||||
if(isset($filter['limit'])) {
|
||||
$limit = $filter['limit'];
|
||||
unset($filter['limit']);
|
||||
}
|
||||
|
||||
unset($filter['order']);
|
||||
|
||||
$filter_nogroup = $filter;
|
||||
|
||||
//Get user groups
|
||||
$groups = array_keys (users_get_groups ($config["id_user"], $access, false));
|
||||
|
||||
|
@ -360,29 +375,28 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
$order = 'ORDER BY '.$order['field'] . ' ' . $order['order'];
|
||||
}
|
||||
|
||||
unset($filter['order']);
|
||||
$where = db_format_array_where_clause_sql ($filter, 'AND', '');
|
||||
|
||||
if(isset($filter['offset'])) {
|
||||
$offset = $filter['offset'];
|
||||
unset($filter['offset']);
|
||||
}
|
||||
|
||||
if(isset($filter['limit'])) {
|
||||
$limit = $filter['limit'];
|
||||
unset($filter['limit']);
|
||||
}
|
||||
|
||||
$where = db_format_array_where_clause_sql ($filter, 'AND', ' WHERE (').')';
|
||||
$where_nogroup = db_format_array_where_clause_sql ($filter_nogroup, 'AND', '');
|
||||
|
||||
$sql_extra = enterprise_hook('policies_get_agents_sql_condition');
|
||||
|
||||
$extra = false;
|
||||
if($sql_extra != ENTERPRISE_NOT_HOOK) {
|
||||
if (!empty($sql_extra))
|
||||
$where = sprintf('%s OR %s', $where, $sql_extra);
|
||||
if (!empty($sql_extra)) {
|
||||
$extra = true;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT %s FROM tagente %s %s', implode(',',$fields), $where, $order);
|
||||
|
||||
|
||||
if($extra) {
|
||||
$where = sprintf('%s AND (%s OR %s)', $where, $where_nogroup, $sql_extra);
|
||||
}
|
||||
else {
|
||||
$where = sprintf('%s AND %s', $where, $where_nogroup);
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT %s FROM tagente WHERE %s %s', implode(',',$fields), $where, $order);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
|
|
Loading…
Reference in New Issue