diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7cd8000621..d2bec637bb 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2008-11-08 Esteban Sanchez + + * godmode/reporting/reporting_builder.php: Fixed a notice using + get_db_value() which was replaced by get_db_sql(). + + * include/functions_reporting.php: Fixed an error on + get_fired_alerts_reporting_table() since id_alert field in + talerta_agente_modulo is not reliable. + 2008-11-08 Esteban Sanchez * godmode/reporting/reporting_builder.php: Fixed value of 1 week diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index d96c82997c..947a849fcc 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -64,8 +64,15 @@ if (isset($_GET["get_agent"])) { // Delete module SQL code if ($delete_report_content) { $id_report_content = (int) get_parameter ('id_report_content'); - $order = get_db_value ('`order`', 'treport_content', 'id_rc', $id_report_content); - $sql = sprintf ('UPDATE treport_content SET `order` = `order` -1 WHERE id_report = %d AND `order` > %d', $id_report, $order); + $sql = sprintf ('SELECT `order` + FROM treport_content + WHERE id_rc = %d', + $id_report_content); + $order = get_db_sql ($sql); + $sql = sprintf ('UPDATE treport_content + SET `order` = `order` -1 + WHERE id_report = %d AND `order` > %d', + $id_report, $order); process_sql ($sql); $sql = sprintf ('DELETE FROM treport_content WHERE id_rc = %d', $id_report_content); $result = process_sql ($sql); @@ -81,10 +88,16 @@ if ($content_up) { $id_report_content = (int) get_parameter ('id_report_content'); $order = get_db_value ('`order`', 'treport_content', 'id_rc', $id_report_content); /* Set the previous element order to the current of the content we want to change */ - $sql = sprintf ('UPDATE treport_content SET `order` = `order` + 1 WHERE id_report = %d AND `order` = %d', - $id_report, $order - 1); + $sql = sprintf ('UPDATE treport_content + SET `order` = `order` + 1 + WHERE id_report = %d + AND `order` = %d', + $id_report, $order - 1); $result = process_sql ($sql); - $sql = sprintf ('UPDATE treport_content SET `order` = `order` - 1 WHERE id_rc = %d', $id_report_content); + $sql = sprintf ('UPDATE treport_content + SET `order` = `order` - 1 + WHERE id_rc = %d', + $id_report_content); $result = process_sql ($sql); } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index acdc5bcf16..ef07048a22 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -304,7 +304,7 @@ function get_fired_alerts_reporting_table ($alerts_fired) { $alert = get_db_row ('talerta_agente_modulo', 'id_aam', $id_alert); /* Add alerts fired to $agents_fired_alerts indexed by id_agent */ - $id_agent = $alert['id_agent']; + $id_agent = get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $alert['id_agente_modulo']); if (!isset ($agents[$id_agent])) { $agents[$id_agent] = array (); } @@ -318,11 +318,11 @@ function get_fired_alerts_reporting_table ($alerts_fired) { $table->head[2] = __('Times Fired'); $table->head[3] = __('Priority'); - foreach ($agents as $alerts) { + foreach ($agents as $id_agent => $alerts) { $data = array (); foreach ($alerts as $alert) { if (! isset ($data[0])) - $data[0] = dame_nombre_agente_agentemodulo ($alert['id_agente_modulo']); + $data[0] = dame_nombre_agente ($id_agent); else $data[0] = ''; $data[1] = $alert['descripcion'];