Added support to create scheduled downtimes with past dates

* pandora_console/godmode/setup/setup_general.php,
  pandora_console/include/functions_config.php: Added a config token
	to allow the creation of scheduled downtimes in the past.

* pandora_console/godmode/agentes/planned_downtime.editor.php: Now
	is possible to create a scheduled downtime with a past date
	if the config token is activated.
This commit is contained in:
Alejandro Gallardo Escobar 2014-09-11 11:42:57 +02:00
parent 732630c37f
commit fb02de8bea
3 changed files with 10 additions and 1 deletions

View File

@ -25,6 +25,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
return;
}
$config["past_planned_downtimes"] = isset($config["past_planned_downtimes"]) ? $config["past_planned_downtimes"] : 1;
require_once ('include/functions_users.php');
@ -152,7 +153,7 @@ if ($create_downtime || $update_downtime) {
$datetime_to = strtotime ($once_date_to . ' ' . $once_time_to);
$now = strtotime(date(DATE_FORMAT). ' ' . date(TIME_FORMAT));
if ($type_execution == 'once' && $datetime_from < $now) {
if (!$config["past_planned_downtimes"] && $type_execution == 'once' && $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) {

View File

@ -263,6 +263,12 @@ $table->data['tutorial_mode'][1] =
html_print_select($modes_tutorial, 'tutorial_mode',
$config["tutorial_mode"], '', '', 0, true);
$config["past_planned_downtimes"] = isset($config["past_planned_downtimes"]) ? $config["past_planned_downtimes"] : 1;
$table->data[33][0] = __('Allow create planned downtimes in the past') .
ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
$table->data[33][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'&nbsp;&nbsp;';
$table->data[33][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo "<fieldset>";

View File

@ -184,6 +184,8 @@ function config_update_config () {
$error_update[] = __('Server logs directory');
if (!config_update_value ('tutorial_mode', get_parameter('tutorial_mode')))
$error_update[] = __('Tutorial mode');
if (!config_update_value ('past_planned_downtimes', get_parameter('past_planned_downtimes')))
$error_update[] = __('Allow create planned downtimes in the past');
break;
case 'enterprise':
if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) {