From 55f61be1260b3f4b6ee093fe941a5c4f9eafa39d Mon Sep 17 00:00:00 2001 From: ramonn Date: Thu, 9 Sep 2010 18:14:05 +0000 Subject: [PATCH] 2010-09-09 Ramon Novoa * lib/PandoraFMS/Core.pm: Fixed alert behaviour when time_from is greater than time_to. Fixes bug #3048043. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3236 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 7018ca25c0..e003b49292 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-09-09 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Fixed alert behaviour when time_from is + greater than time_to. Fixes bug #3048043. + 2010-09-08 Sancho Lerena * util/compaq_chassis_trap_manager.pl, diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 6efbd61453..7909004240 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -228,8 +228,13 @@ sub pandora_evaluate_alert ($$$$$$$) { # Check time slot my $time = sprintf ("%.2d:%.2d:%.2d", $hour, $min, $sec); - return 1 if (($alert->{'time_to'} ne $alert->{'time_from'}) && - (($time ge $alert->{'time_to'}) || ($time le $alert->{'time_from'}))); + if (($alert->{'time_from'} ne $alert->{'time_to'})) { + if ($alert->{'time_from'} lt $alert->{'time_to'}) { + return 1 if (($time le $alert->{'time_from'}) || ($time ge $alert->{'time_to'})); + } else { + return 1 if (($time le $alert->{'time_from'}) && ($time ge $alert->{'time_to'})); + } + } # Check time threshold my $limit_utimestamp = $alert->{'last_reference'} + $alert->{'time_threshold'};