diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7227cb1939..4989fcd789 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2011-05-18 Miguel de Dios + + * include/functions_agents.php: changed the source code to fixed the + enterprise call in function "agents_get_agents". + + * operation/agentes/estado_agente.php: apply the change to the call + "agents_get_agents". + + Fixes: #3303426 + 2011-05-18 Juan Manuel Ramon * include/functions_graph.php diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 586f492150..8c55c02343 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -151,8 +151,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f $filter .= db_format_array_where_clause_sql ($options); } - if (($id_agent !== false) && ($idGroup !== false)) { - + if (($id_agent === false) && ($idGroup !== false)) { if ($idGroup != 0) { //All group $subQuery = 'SELECT id_agente_modulo FROM tagente_modulo @@ -372,7 +371,11 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o $filter['order'] = $order['field'] . ' ' . $order['order']; if ($enterprise_include) { - add_enterprise_agents_get_agents_filter_acl($filter); + $ids = get_id_agents_user_profile_policy(); + + if (!empty($filter['id_agente'])) { + $filter['id_agente'] = array_intersect($filter['id_agente'], $ids); + } } return db_get_all_rows_filter ('tagente', $filter, $fields); @@ -804,7 +807,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower $search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' '; break; case "oracle": - $search_sql .= ' AND UPPER(nombre) LIKE UPPER(\'' . $name . '\') '; + $search_sql .= ' AND nombre LIKE UPPER("' . $name . '") '; break; } @@ -959,29 +962,13 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false } if ($value[0] == '%') { - switch ($config['dbtype']){ - case "mysql": - case "postgresql": - array_push ($fields, $field.' LIKE "'.$value.'"'); - break; - case "oracle": - array_push ($fields, $field.' LIKE \''.$value.'\''); - break; - } + array_push ($fields, $field.' LIKE "'.$value.'"'); } else if ($operatorDistin) { array_push($fields, $field.' <> ' . substr($value, 2)); } else if (substr($value, -1) == '%') { - switch ($config['dbtype']){ - case "mysql": - case "postgresql": - array_push ($fields, $field.' LIKE "'.$value.'"'); - break; - case "oracle": - array_push ($fields, $field.' LIKE \''.$value.'\''); - break; - } + array_push ($fields, $field.' LIKE "'.$value.'"'); } else { switch ($config["dbtype"]) { diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index da091e4501..af98f6c197 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -269,30 +269,25 @@ else { $total_agents = 0; $agents = false; if (! empty ($agent_names)) { - $subquery_enterprise = ''; - if (ENTERPRISE_NOT_HOOK !== enterprise_include_once('include/functions_policies.php')) { - $subquery_enterprise = subquery_acl_enterprise(); - } - - $total_agents = agents_get_agents(array ('id_agente' => array_keys ($agent_names), - 'order' => 'nombre ASC', - 'disabled' => 0, - 'id_grupo' => $groups), - array ('COUNT(*) as total')); - $total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0; - - $agents = agents_get_agents(array ('id_agente' => array_keys ($agent_names), - 'order' => 'nombre ASC', - 'id_grupo' => $groups, - 'offset' => (int) get_parameter ('offset'), - 'limit' => (int) $config['block_size']), - array ('id_agente', - 'id_grupo', - 'id_os', - 'ultimo_contacto', - 'intervalo'), - 'AR', - $order); + $total_agents = agents_get_agents(array ('id_agente' => array_keys ($agent_names), + 'order' => 'nombre ASC', + 'disabled' => 0, + 'id_grupo' => $groups), + array ('COUNT(*) as total')); + $total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0; + + $agents = agents_get_agents(array ('id_agente' => array_keys ($agent_names), + 'order' => 'nombre ASC', + 'id_grupo' => $groups, + 'offset' => (int) get_parameter ('offset'), + 'limit' => (int) $config['block_size']), + array ('id_agente', + 'id_grupo', + 'id_os', + 'ultimo_contacto', + 'intervalo'), + 'AR', + $order); } if (empty ($agents)) {