diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index d8e337c738..d5455f22f4 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -52,7 +52,7 @@ $once_time_to = (string) get_parameter ('once_time_to', date(TIME_FORMAT)); $periodically_day_from = (int) get_parameter ('periodically_day_from', 1); $periodically_day_to = (int) get_parameter ('periodically_day_to', 31); $periodically_time_from = (string) get_parameter ('periodically_time_from', date(TIME_FORMAT)); -$periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT)); +$periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT, time() + SECONDS_1HOUR)); $first_create = (int) get_parameter ('first_create', 0); @@ -153,12 +153,19 @@ if ($create_downtime || $update_downtime) { $datetime_to = strtotime ($once_date_to . ' ' . $once_time_to); $now = strtotime(date(DATE_FORMAT). ' ' . date(TIME_FORMAT)); - if (!$config["past_planned_downtimes"] && $type_execution == 'once' && $datetime_from < $now) { + if ($type_execution == 'once' && !$config["past_planned_downtimes"] && $datetime_from < $now) { ui_print_error_message(__('Not created. Error inserting data. Start time must be higher than the current time' )); } else if ($type_execution == 'once' && $datetime_from >= $datetime_to) { - ui_print_error_message(__('Not created. Error inserting data' ). - ': START >= END'); + ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end date must be higher than the start date')); + } + else if ($type_execution == 'periodically' + && (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to) + || ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))) { + ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end time must be higher than the start time')); + } + else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from >= $periodically_day_to) { + ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end day must be higher than the start day')); } else { $sql = ''; @@ -324,35 +331,35 @@ $table->data[3][1] = html_print_select(array('quiet' => __('Quiet'), 'type_downtime', $type_downtime, 'change_type_downtime()', '', 0, true, false, true, ''); $table->data[4][0] = __('Execution'); -$table->data[4][1] = html_print_select(array('once' => __('once'), +$table->data[4][1] = html_print_select(array('once' => __('Once'), 'periodically' => __('Periodically')), 'type_execution', $type_execution, 'change_type_execution();', '', 0, true); $days = array_combine(range(1, 31), range(1, 31)); -$table->data[5][0] = __('Configure the time'); +$table->data[5][0] = __('Configure the time') . " " . ui_print_help_icon ('planned_downtime_time', true);; $table->data[5][1] = "