function prepareInputForAdd($input)
 {
     // Toolbox::logInFile("pm-downtime", "Downtime, prepareInputForAdd\n");
     if ($this->isExpired()) {
         Session::addMessageAfterRedirect(__('Downtime period has already expired!', 'monitoring'), false, ERROR);
         return false;
     }
     // Check user ...
     if ($input["users_id"] == NOT_AVAILABLE) {
         $input["users_id"] = $_SESSION['glpiID'];
     }
     // Compute duration in seconds
     if ($input['duration'] == 0) {
         $input['duration_seconds'] = 0;
     } else {
         $multiple = 1;
         if ($input['duration_type'] == 'seconds') {
             $multiple = 1;
         } else {
             if ($input['duration_type'] == 'minutes') {
                 $multiple = 60;
             } else {
                 if ($input['duration_type'] == 'hours') {
                     $multiple = 3600;
                 } else {
                     if ($input['duration_type'] == 'days') {
                         $multiple = 86400;
                     }
                 }
             }
         }
         $input['duration_seconds'] = $multiple * $input['duration'];
     }
     $user = new User();
     $user->getFromDB($input['users_id']);
     // Downtime is to be created ...
     // ... send information to shinken via webservice
     $pmShinkenwebservice = new PluginMonitoringShinkenwebservice();
     if ($pmShinkenwebservice->sendDowntime($input['plugin_monitoring_hosts_id'], -1, $user->getName(1), $input['comment'], $input['flexible'], $input['start_time'], $input['end_time'], $input['duration_seconds'], 'add')) {
         // ... and then send an acknowledge for the host
         if ($pmShinkenwebservice->sendAcknowledge($input['plugin_monitoring_hosts_id'], -1, $user->getName(1), $input['comment'], '1', '1', '1')) {
             // Set host as acknowledged
             $pmHost = new PluginMonitoringHost();
             $pmHost->getFromDB($input['plugin_monitoring_hosts_id']);
             $pmHost->setAcknowledged($input['comment']);
             $a_services = $pmHost->getServicesID();
             if (is_array($a_services)) {
                 foreach ($a_services as $service_id) {
                     // Send downtime for a service to shinken via webservice
                     $pmShinkenwebservice->sendDowntime(-1, $service_id, $user->getName(1), $input['comment'], $input['flexible'], $input['start_time'], $input['end_time'], $input['duration_seconds'], 'add');
                     /*
                                       // Send acknowledge command for a service to shinken via webservice
                                       if ($pmShinkenwebservice->sendAcknowledge(-1,
                                                                                 $service_id,
                                                                                 $user->getName(1),
                                                                                 $input['comment'],
                                                                                 '1', '1', '1')) {
                                          // Set service as acknowledged
                                          $pmService = new PluginMonitoringService();
                                          $pmService->getFromDB($service_id);
                                          $pmService->setAcknowledged($input['comment']);
                                       }
                     */
                 }
             }
         }
         Session::addMessageAfterRedirect(__('Downtime notified to the monitoring application:', 'monitoring'));
         $input['notified'] = 1;
     } else {
         Session::addMessageAfterRedirect(__('Downtime has not been accepted by the monitoring application:', 'monitoring'), false, ERROR);
         return false;
     }
     return $input;
 }