From 07b7b9bdc1ffb873c04ccedff8a9e645b0bf4188 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Wed, 30 Nov 2011 16:31:09 +0000 Subject: [PATCH] 2011-11-30 Juan Manuel Ramon * include/functions_agents.php: Fixed call to agents_get_modules with id_agent = 0. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5218 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions_agents.php | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e73682b35f..cd0f7e60a0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-11-30 Juan Manuel Ramon + + * include/functions_agents.php: Fixed call to agents_get_modules + with id_agent = 0. + 2011-11-30 Sergio Martin * operation/agentes/estado_agente.php: Fixed pagination transfer diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index ad15ed3a47..f82d3de852 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -977,12 +977,15 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false } $id_agent = safe_int ($id_agent, 1); - - $extra_sql = enterprise_hook('policies_get_modules_sql_condition', array($id_agent)); - if ($extra_sql === ENTERPRISE_NOT_HOOK) { - $extra_sql = ''; - }else if ($extra_sql != '') { - $extra_sql .= ' OR '; + + $extra_sql = ''; + if ($id_agent != 0){ + $extra_sql = enterprise_hook('policies_get_modules_sql_condition', array($id_agent)); + if ($extra_sql === ENTERPRISE_NOT_HOOK) { + $extra_sql = ''; + }else if ($extra_sql != '') { + $extra_sql .= ' OR '; + } } $userGroups = users_get_groups($config['id_user'], 'AR', false); @@ -1152,7 +1155,7 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false } $result = db_get_all_rows_sql ($sql); - + if (empty ($result)) { return array (); } @@ -1484,7 +1487,7 @@ function agents_get_status($id_agent = 0) { if(($module_type >= 21 && $module_type <= 23) || $module_type == 100) { $modules_async++; } - } + } // If all the modules are asynchronous or keep alive, the group cannot be unknown if($modules_async < count($modules)) {