diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 11dc3ef1c0..dd9f911fa9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2010-04-05 Miguel de Dios + + * include/functions_agents.php: changed the functions + "get_agent_alerts_simple" and "get_agent_alerts_compound" delete new + parameter $limit because you can set the pagination limit in the parameter + $options. + + * operation/agentes/alerts_status.php: changed the calls to previus + functions. + 2010-04-06 Pablo de la ConcepciĆ³n * operation/menu.php, godmode/menu.php: Hooks to services pages (Enterprise) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index efcfca507a..7846ebfc93 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -109,7 +109,7 @@ function create_agent ($name, $id_group, $interval, $ip_address, $values = false * @return array All simple alerts defined for an agent. Empty array if no * alerts found. */ -function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = false, $where = '', $allModules = false, $orderby = false, $limit = false, $idGroup = false, $count = false) { +function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = false, $where = '', $allModules = false, $orderby = false, $idGroup = false, $count = false) { switch ($filter) { case "notfired": @@ -159,11 +159,6 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa if ($orderby !== false) $orderbyText = sprintf("ORDER BY %s", $orderby); - $limitText = ''; - if ($limit !== false) { - $limitText = 'LIMIT ' . $limit['offset'] . ', ' . $limit['block_size']; - } - $selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name'; if ($count !== false) { $selectText = 'COUNT(talert_template_modules.id) AS count'; @@ -173,8 +168,8 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa FROM talert_template_modules INNER JOIN tagente_modulo AS t2 ON talert_template_modules.id_agent_module = t2.id_agente_modulo - WHERE id_agent_module in (%s) %s %s %s %s", - $selectText, $subQuery, $where, $filter, $orderbyText, $limitText); + WHERE id_agent_module in (%s) %s %s %s", + $selectText, $subQuery, $where, $filter, $orderbyText); $alerts = get_db_all_rows_sql ($sql); //debugPrint($sql); @@ -199,7 +194,7 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa * * @return array An array with all combined alerts defined for an agent. */ -function get_agent_alerts_compound ($id_agent = false, $filter = '', $options = false, $idGroup = false, $limit = false, $count = false, $where = '') { +function get_agent_alerts_compound ($id_agent = false, $filter = '', $options = false, $idGroup = false, $count = false, $where = '') { switch ($filter) { case "notfired": $filter = ' AND times_fired = 0 AND disabled = 0'; @@ -239,19 +234,14 @@ function get_agent_alerts_compound ($id_agent = false, $filter = '', $options = $subQuery = implode (',', $id_agent); } - $limitText = ''; - if ($limit !== false) { - $limitText = 'LIMIT ' . $limit['offset'] . ', ' . $limit['block_size']; - } - $selectText = '*'; if ($count !== false) { $selectText = 'COUNT(id) AS count'; } $sql = sprintf ("SELECT %s FROM talert_compound - WHERE id_agent IN (%s) %s %s %s", - $selectText, $subQuery, $where, $filter, $limitText); + WHERE id_agent IN (%s) %s %s", + $selectText, $subQuery, $where, $filter); $alerts = get_db_all_rows_sql ($sql);//debugPrint($sql); diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 078500049a..fc1a8cf093 100644 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -104,10 +104,10 @@ else { } $alerts = array(); -$alerts['alerts_simple'] = get_agent_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, array('block_size' => $config["block_size"], 'offset' => $offset_simple), $idGroup); -$countAlertsSimple = get_agent_alerts_simple ($agents, $filter, false, '', false, false, false, $idGroup, true); -$alerts['alerts_combined'] = get_agent_alerts_compound($agents, $filter, false, $idGroup, array('block_size' => $config["block_size"], 'offset' => $offset_combined), false, $whereAlertCombined); -$countAlertsCombined = get_agent_alerts_compound($agents, $filter, false, $idGroup, false, true, $whereAlertCombined); +$alerts['alerts_simple'] = get_agent_alerts_simple ($agents, $filter, array('offset' => $offset_simple, 'limit' => $config['block_size']), $whereAlertSimple, false, false, $idGroup); +$countAlertsSimple = get_agent_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, $idGroup, true); +$alerts['alerts_combined'] = get_agent_alerts_compound($agents, $filter, array('limit' => $config["block_size"], 'offset' => $offset_combined), $idGroup, false, $whereAlertCombined); +$countAlertsCombined = get_agent_alerts_compound($agents, $filter, false, $idGroup, true, $whereAlertCombined); if ($tab != null) { $url = $url.'&tab='.$tab; }