diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index cf57595210..d1340da007 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2013-02-12 Miguel de Dios + + * godmode/agentes/planned_downtime.list.php, + godmode/agentes/planned_downtime.editor.php: fixed the planned + downtime. + + Fixes: #3602365 + 2013-02-12 Sergio Martin * include/functions_config.php: Fixed the update of the diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 76ae966ae3..68783ab572 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -59,7 +59,7 @@ $first_create = (int) get_parameter ('first_create', 0); $create_downtime = (int) get_parameter ('create_downtime'); -$stop_downtime = (int) get_parameter ('stop_downtime'); + $edit_downtime = (int) get_parameter ('edit_downtime'); $update_downtime = (int) get_parameter ('update_downtime'); $id_downtime = (int) get_parameter ('id_downtime',0); @@ -81,32 +81,7 @@ $friday = (bool) get_parameter ('friday'); $saturday = (bool) get_parameter ('saturday'); $sunday = (bool) get_parameter ('sunday'); -// STOP DOWNTIME -if ($stop_downtime == 1) { - $sql = "SELECT * FROM tplanned_downtime where id=$id_downtime"; - $result = db_get_row_sql($sql); - $name = $result['name']; - $description = $result['description']; - $date_from = $result['date_from']; - $executed = $result['executed']; - $id_group = $result['id_group']; - $only_alerts = $result['only_alerts']; - $date_stop = date ("Y-m-j",get_system_time ()); - $time_stop = date ("h:iA",get_system_time ()); - $date_time_stop = strtotime ($date_stop . ' ' . $time_stop); - - $values = array( - 'name' => $name, - 'description' => $description, - 'date_from' => $date_from, - 'date_to' => $date_time_stop, - 'executed' => $executed, - 'id_group' => $id_group, - 'only_alerts' => $only_alerts - ); - - $result = db_process_sql_update('tplanned_downtime', $values, array ('id' => $id_downtime)); -} + // INSERT A NEW DOWNTIME_AGENT ASSOCIATION if ($insert_downtime_agent == 1) { @@ -121,7 +96,7 @@ if ($insert_downtime_agent == 1) { $all_modules = true; } - for ($a=0;$a $datetime_to) { - echo '

'.__('Not created. Error inserting data').': START > END

'; + if (($type_periodicity == 'once') && + ($datetime_from >= $datetime_to)) { + ui_print_error_message(__('Not created. Error inserting data' ). + ': START >= END'); } else { $sql = ''; @@ -206,13 +183,13 @@ if ($create_downtime || $update_downtime) { 'tplanned_downtime', $values); } else { - echo "

" . - __('Each planned downtime must have a different name')."

"; + ui_print_error_message( + __('Each planned downtime must have a different name')); } } else { - echo '

' . - __('Planned downtime must have a name').'

'; + ui_print_error_message( + __('Planned downtime must have a name')); } } else if ($update_downtime) { @@ -243,25 +220,26 @@ if ($create_downtime || $update_downtime) { $result = db_process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime)); } else { - echo '

'.__('Planned downtime must have a name').'

'; + ui_print_error_message( + __('Planned downtime must have a name')); } } if ($result === false) { if ($create_downtime) { - echo '

'.__('Could not be created').'

'; + ui_print_error_message(__('Could not be created')); } else { - echo '

'.__('Could not be updated').'

'; + ui_print_error_message(__('Could not be updated')); } } else { if ($create_downtime && $name && !$check) { $id_downtime = $result; - echo '

' . __('Successfully created') . '

'; + ui_print_success_message(__('Successfully created')); } else if ($update_downtime && $name) { - echo '

'.__('Successfully updated').'

'; + ui_print_success_message(__('Successfully updated')); } } } @@ -327,7 +305,7 @@ $table->data[3][0] = __('Type'); $table->data[3][1] = html_print_select(array('quiet' => __('Quiet'), 'disable_agents' => __('Disabled Agents'), 'disable_agents_alerts' => __('Disabled only Alerts')), - 'type_downtime', $type_downtime, '', '', 0, true, false, true, + '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'), @@ -398,12 +376,12 @@ $table->data[5][1] = " " . __('From day:') . " ". html_print_select($days, - 'periodically_day_from', $periodically_day_from, '', '', 0, true) . + 'periodically_day_from', $periodically_day_from, '', '', 0, true) . " " . __('To day:') . " ". html_print_select($days, - 'periodically_day_to', $periodically_day_to, '', '', 0, true) . + 'periodically_day_to', $periodically_day_to, '', '', 0, true) . " @@ -503,7 +481,9 @@ if ($id_downtime > 0) { ui_print_help_tip (__('Only for type Quiet for downtimes.'), true) . ''; if ($type_downtime != 'quiet') - echo '
'; + echo '