2012-01-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_api.php: removed warning from get_all_agents
	function.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5426 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-01-25 10:33:37 +00:00
parent d0be1f2740
commit ea22cf8722
2 changed files with 81 additions and 61 deletions

View File

@ -1,3 +1,8 @@
2012-01-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_api.php: removed warning from get_all_agents
function.
2012-01-25 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_agents.php: Fixed bug: Don't show

View File

@ -771,18 +771,25 @@ function get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$where = '';
if (isset($other['data'][0])){
// Filter by SO
if ($other['data'][0] != ""){
$where .= " AND id_os = " . $other['data'][0];
}
}
if (isset($other['data'][1])){
// Filter by group
if ($other['data'][1] != ""){
$where .= " AND id_grupo = " . $other['data'][1];
}
}
if (isset($other['data'][3])){
// Filter by name
if ($other['data'][3] != ""){
$where .= " AND nombre LIKE ('%" . $other['data'][3] . "%')";
}
}
if (isset($other['data'][4])){
// Filter by policy
if ($other['data'][4] != ""){
$filter_by_policy = enterprise_hook('policies_get_filter_by_agent', array($other['data'][4]));
@ -790,13 +797,17 @@ function get_all_agents($thrash1, $thrash2, $other, $thrash3) {
$where .= $filter_by_policy;
}
}
}
// Initialization of array
$result_agents = array();
// Filter by state
$sql = "SELECT id_agente, nombre FROM tagente WHERE disabled = 0 " . $where;
$all_agents = db_get_all_rows_sql($sql);
// Filter by status: unknown, warning, critical, without modules
if (isset($other['data'][2])){
if ($other['data'][2] != "") {
foreach($all_agents as $agent){
$filter_modules['id_agente'] = $agent['id_agente'];
@ -849,6 +860,10 @@ function get_all_agents($thrash1, $thrash2, $other, $thrash3) {
else {
$result_agents = $all_agents;
}
}
else {
$result_agents = $all_agents;
}
if (count($result_agents) > 0 and $result_agents !== false){
$data = array('type' => 'array', 'data' => $result_agents);