Error fixes and improvements. Improved the help tips of the planned downtimes editor
This commit is contained in:
parent
43a8dc0219
commit
6f6debb324
pandora_console
|
@ -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] = "
|
||||
<div id='once_time' style='display: none;'>
|
||||
<table>
|
||||
<tr>
|
||||
<td>" .
|
||||
__('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) .
|
||||
"</td>
|
||||
<td>".
|
||||
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) .
|
||||
"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>" .
|
||||
__('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) .
|
||||
"</td>
|
||||
<td>".
|
||||
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) .
|
||||
"</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -360,8 +367,7 @@ $table->data[5][1] = "
|
|||
<div id='periodically_time' style='display: none;'>
|
||||
<table>
|
||||
<tr>
|
||||
<td>" . __('Type Periodicity:') . "</td>
|
||||
<td>".
|
||||
<td>" . __('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) .
|
||||
"</td>
|
||||
<td>" . ui_print_help_tip(__('The end day must be higher than the start day'), true) . "</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
|
@ -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').
|
||||
".<br>".__('The end time must be higher than the start time'), true) .
|
||||
"</td>
|
||||
<td>" . __('To hour:') . "</td>
|
||||
<td>".
|
||||
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').
|
||||
".<br>".__('The end time must be higher than the start time'), true) .
|
||||
"</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue