From 4b6883109ed2ffd58dc75082e3f044fb56fa65bf Mon Sep 17 00:00:00 2001 From: esanchezm Date: Thu, 15 Jan 2009 10:54:27 +0000 Subject: [PATCH] 2009-01-15 Esteban Sanchez * godmode/alerts/configure_alert_template.php: Max and min alerts were ignored. * include/functions_alerts.php: Ensure the max and min alert values order. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1345 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ .../godmode/alerts/configure_alert_template.php | 6 +++++- pandora_console/include/functions_alerts.php | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7667ee805f..82986b92e0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2009-01-15 Esteban Sanchez + + * godmode/alerts/configure_alert_template.php: Max and min alerts + were ignored. + + * include/functions_alerts.php: Ensure the max and min alert values + order. + 2009-01-15 Esteban Sanchez * include/styles/menu.css: Changed the z-index property of the menu diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 69becac3e4..8cc61ef1e3 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -112,6 +112,8 @@ function update_template ($step) { $time_to = (string) get_parameter ('time_to'); $time_to = date ("H:s:00", strtotime ($time_to)); $threshold = (int) get_parameter ('threshold'); + $max_alerts = (int) get_parameter ('max_alerts'); + $min_alerts = (int) get_parameter ('min_alerts'); if ($threshold == -1) $threshold = (int) get_parameter ('other_threshold'); $field1 = (string) get_parameter ('field1'); @@ -138,7 +140,9 @@ function update_template ($step) { 'default_action' => $default_action, 'field1' => $field1, 'field2' => $field2, - 'field3' => $field3 + 'field3' => $field3, + 'max_alerts' => $max_alerts, + 'min_alerts' => $min_alerts ); if ($default_action) { diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index d99a2b91aa..fc25531b1f 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -312,6 +312,11 @@ function clean_alert_template_values ($values, $set_empty = true) { $retvalues['max_alerts'] = (int) $values['max_alerts']; if (isset ($values['min_alerts'])) $retvalues['min_alerts'] = (int) $values['min_alerts']; + /* Ensure max an min orders */ + $max = max ($retvalues['max_alerts'], $retvalues['min_alerts']); + $min = min ($retvalues['max_alerts'], $retvalues['min_alerts']); + $retvalues['max_alerts'] = $max; + $retvalues['min_alerts'] = $min; if (isset ($values['monday'])) $retvalues['monday'] = (bool) $values['monday']; if (isset ($values['tuesday']))