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] = "
" .
__('From:') .
- ui_print_help_tip(__('Date format in Pandora is year/month/day'), true) .
- ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds'), true) .
" |
".
html_print_input_text ('once_date_from', $once_date_from, '', 10, 10, true) .
- html_print_input_text ('once_time_from', $once_time_from, '', 9, 9, true) .
+ ui_print_help_tip(__('Date format in Pandora is year/month/day'), true) .
+ html_print_input_text ('once_time_from', $once_time_from, '', 9, 9, true) .
+ ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds'), true) .
" |
" .
__('To:') .
- ui_print_help_tip(__('Date format in Pandora is year/month/day'), true) .
- ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds'), true) .
" |
".
html_print_input_text ('once_date_to', $once_date_to, '', 10, 10, true) .
- html_print_input_text ('once_time_to', $once_time_to, '', 9, 9, true) .
+ ui_print_help_tip(__('Date format in Pandora is year/month/day'), true) .
+ html_print_input_text ('once_time_to', $once_time_to, '', 9, 9, true) .
+ ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds'), true) .
" |
@@ -360,8 +367,7 @@ $table->data[5][1] = "
- " . __('Type Periodicity:') . " |
- ".
+ | " . __('Type Periodicity:') . " ".
html_print_select(array(
'weekly' => __('Weekly'),
'monthly' => __('Monthly')),
@@ -408,6 +414,7 @@ $table->data[5][1] = "
html_print_select($days,
'periodically_day_to', $periodically_day_to, '', '', 0, true) .
" |
+ " . ui_print_help_tip(__('The end day must be higher than the start day'), true) . " |
@@ -417,12 +424,16 @@ $table->data[5][1] = "
html_print_input_text (
'periodically_time_from',
$periodically_time_from, '', 7, 7, true) .
+ ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds').
+ ".
".__('The end time must be higher than the start time'), true) .
"
" . __('To hour:') . " |
".
html_print_input_text (
'periodically_time_to',
- $periodically_time_to, '', 7, 7, true) .
+ $periodically_time_to, '', 7, 7, true) .
+ ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds').
+ ". ".__('The end time must be higher than the start time'), true) .
" |
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index afeefd2eda..0968734d4d 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1095,22 +1095,22 @@ function reporting_get_planned_downtimes ($start_date, $end_date, $id_agent_modu
$periodically_monthly_w = "type_periodicity = 'monthly'
AND (((periodically_day_from > '$start_day'
OR (periodically_day_from = '$start_day'
- AND periodically_time_from > '$start_time'))
+ AND periodically_time_from >= '$start_time'))
AND (periodically_day_to < '$end_day'
OR (periodically_day_to = '$end_day'
- AND periodically_time_to < '$end_time')))
+ AND periodically_time_to <= '$end_time')))
OR ((periodically_day_from < '$start_day'
OR (periodically_day_from = '$start_day'
- AND periodically_time_from < '$start_time'))
+ AND periodically_time_from <= '$start_time'))
AND (periodically_day_to > '$start_day'
OR (periodically_day_to = '$start_day'
- AND periodically_time_to > '$start_time')))
+ AND periodically_time_to >= '$start_time')))
OR ((periodically_day_from < '$end_day'
OR (periodically_day_from = '$end_day'
- AND periodically_time_from < '$end_time'))
+ AND periodically_time_from <= '$end_time'))
AND (periodically_day_to > '$end_day'
OR (periodically_day_to = '$end_day'
- AND periodically_time_to > '$end_time'))))";
+ AND periodically_time_to >= '$end_time'))))";
}
$periodically_weekly_days = array();