From 1018edcffddd46d9b3e7f0ad686bf7dbe9f14c86 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 7 Nov 2014 12:44:36 +0100 Subject: [PATCH] Improved some SLA functions to stop the calculations when the module id is invalid --- pandora_console/include/functions_reporting.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 93cad7bd2c..fda41cc284 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -412,6 +412,9 @@ function reporting_get_agentmodule_data_sum ($id_agent_module, $period=0, $date */ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) { global $config; + + if (empty($id_agent_module)) + return false; // Initialize variables if (empty ($date)) { @@ -578,6 +581,9 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu */ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) { global $config; + + if (empty($id_agent_module)) + return false; // Initialize variables if (empty ($date)) { @@ -885,6 +891,9 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_date, $end_date, $check_services = false) { global $config; + if (empty($id_agent_module)) + return false; + require_once ($config['homedir'] . '/include/functions_planned_downtimes.php'); $malformed_planned_downtimes = planned_downtimes_get_malformed(); @@ -907,7 +916,7 @@ function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_dat ) tpdr ORDER BY tpdr.id"; - $downtimes = @db_get_all_rows_sql($sql_downtime); + $downtimes = db_get_all_rows_sql($sql_downtime); if ($downtimes == false) { $downtimes = array(); @@ -1248,7 +1257,7 @@ function reporting_get_planned_downtimes ($start_date, $end_date, $id_agent_modu OR (date_from <= '$end_date' AND date_to >= '$end_date')))"; } - $downtimes = @db_get_all_rows_sql($sql_downtime); + $downtimes = db_get_all_rows_sql($sql_downtime); if ($downtimes == false) { $downtimes = array(); }