2008-11-08 Esteban Sanchez <estebans@artica.es>

* 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.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1227 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-11-08 12:16:03 +00:00
parent 6fa9a71836
commit de2f981319
3 changed files with 30 additions and 8 deletions

View File

@ -1,3 +1,12 @@
2008-11-08 Esteban Sanchez <estebans@artica.es>
* 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 <estebans@artica.es> 2008-11-08 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/reporting_builder.php: Fixed value of 1 week * godmode/reporting/reporting_builder.php: Fixed value of 1 week

View File

@ -64,8 +64,15 @@ if (isset($_GET["get_agent"])) {
// Delete module SQL code // Delete module SQL code
if ($delete_report_content) { if ($delete_report_content) {
$id_report_content = (int) get_parameter ('id_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 ('SELECT `order`
$sql = sprintf ('UPDATE treport_content SET `order` = `order` -1 WHERE id_report = %d AND `order` > %d', $id_report, $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); process_sql ($sql);
$sql = sprintf ('DELETE FROM treport_content WHERE id_rc = %d', $id_report_content); $sql = sprintf ('DELETE FROM treport_content WHERE id_rc = %d', $id_report_content);
$result = process_sql ($sql); $result = process_sql ($sql);
@ -81,10 +88,16 @@ if ($content_up) {
$id_report_content = (int) get_parameter ('id_report_content'); $id_report_content = (int) get_parameter ('id_report_content');
$order = get_db_value ('`order`', 'treport_content', 'id_rc', $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 */ /* 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', $sql = sprintf ('UPDATE treport_content
$id_report, $order - 1); SET `order` = `order` + 1
WHERE id_report = %d
AND `order` = %d',
$id_report, $order - 1);
$result = process_sql ($sql); $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); $result = process_sql ($sql);
} }

View File

@ -304,7 +304,7 @@ function get_fired_alerts_reporting_table ($alerts_fired) {
$alert = get_db_row ('talerta_agente_modulo', 'id_aam', $id_alert); $alert = get_db_row ('talerta_agente_modulo', 'id_aam', $id_alert);
/* Add alerts fired to $agents_fired_alerts indexed by id_agent */ /* 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])) { if (!isset ($agents[$id_agent])) {
$agents[$id_agent] = array (); $agents[$id_agent] = array ();
} }
@ -318,11 +318,11 @@ function get_fired_alerts_reporting_table ($alerts_fired) {
$table->head[2] = __('Times Fired'); $table->head[2] = __('Times Fired');
$table->head[3] = __('Priority'); $table->head[3] = __('Priority');
foreach ($agents as $alerts) { foreach ($agents as $id_agent => $alerts) {
$data = array (); $data = array ();
foreach ($alerts as $alert) { foreach ($alerts as $alert) {
if (! isset ($data[0])) if (! isset ($data[0]))
$data[0] = dame_nombre_agente_agentemodulo ($alert['id_agente_modulo']); $data[0] = dame_nombre_agente ($id_agent);
else else
$data[0] = ''; $data[0] = '';
$data[1] = $alert['descripcion']; $data[1] = $alert['descripcion'];