From 11dccd905494b0b864b659487d8f482ac36ea00f Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 22 Dec 2016 16:27:20 +0100 Subject: [PATCH] Fixed sql error and added "no actions" text in alert module reports. Ticket #4301 (cherry picked from commit fa8f6ca37ca3a2c329fdc3b9a7cb090ed146e875) --- .../include/functions_reporting.php | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 1bee1db448..ceba437b79 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2939,7 +2939,7 @@ function reporting_alert_report_module($report, $content) { } $data = array(); - + $actions = array(); foreach ($alerts as $alert) { $data_row = array(); @@ -2968,14 +2968,21 @@ function reporting_alert_report_module($report, $content) { $id_action = 0; } else { - $actions = db_get_all_rows_sql('SELECT name - FROM talert_actions - WHERE id = ' . $id_action); + if ($id_action != null) { + $actions = db_get_all_rows_sql('SELECT name + FROM talert_actions + WHERE id = ' . $id_action); + } } - $data_row['action'] = array(); - foreach ($actions as $action) { - $data_row['action'][] = $action['name']; + if (empty($actions)) { + $data_row['action'][] = __('No defined actions'); + } + else { + $data_row['action'] = array(); + foreach ($actions as $action) { + $data_row['action'][] = $action['name']; + } } $data_row['fired'] = array();