diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 2c6d71b2ad..984fed5642 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -669,13 +669,12 @@ $table_advanced->data[2][3] = __('Max. Value'); $table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); $table_advanced->colspan[2][4] = 3; - $table_advanced->data[3][0] = __('Dynamic Threshold Interval'); $table_advanced->data[3][1] = html_print_extended_select_for_time( 'dynamic_interval', $dynamic_interval, '', - 'None', + __('None'), '0', 10, true, diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c519645560..9eb379af83 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2075,7 +2075,7 @@ function html_print_extended_select_for_time( $custom_fields=false, $style_icon='', $no_change=false, - $allow_zero=false + $allow_zero=0 ) { global $config; $admin = is_user_admin($config['id_user']); @@ -2089,32 +2089,21 @@ function html_print_extended_select_for_time( $fields['-2'] = __('No change'); } - if (! $selected) { - foreach ($fields as $t_key => $t_value) { - if ($t_key != -1) { - if ($nothing == '') { - // -1 means 'custom' - $selected = $t_key; - break; - } else { - $selected = $nothing; - break; - } - } - } - } - - // Allow the use of the value zero. - if ($allow_zero === true) { - $selected_zero = true; - } else { - $selected_zero = ($selected != 0) ? true : false; - } - - if (($selected !== false) && (!isset($fields[$selected]) && $selected_zero)) { + if (empty($selected) === false + && $selected !== '0' + && isset($fields[$selected]) === false + ) { + $allow_zero = false; $fields[$selected] = human_time_description_raw($selected, true); } + if (empty($nothing) === true + && (empty($selected) === true + || $selected === '0') + ) { + $selected = 300; + } + $units = [ 1 => __('seconds'), SECONDS_1MINUTE => __('minutes'), @@ -2180,14 +2169,23 @@ function html_print_extended_select_for_time( $uniq_name.'_units', '1', ''.$script, - $nothing, - $nothing_value, + '', + 0, false, false, false, $class, $readonly, - 'font-size: xx-small;'.$select_style + 'padding: 7px 3px;'.$select_style, + false, + false, + false, + '', + false, + false, + false, + false, + false ); echo ' '.html_print_image( 'images/list.png', @@ -2202,7 +2200,7 @@ function html_print_extended_select_for_time( echo ''; echo "