예제 #1
0
 /**
  * @see CommonDBTM::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     if (empty($input['end_date']) || $input['end_date'] == 'NULL' || $input['end_date'] < $input['begin_date']) {
         $input['end_date'] = $input['begin_date'];
     }
     return parent::prepareInputForUpdate($input);
 }
예제 #2
0
 /**
  * @see CommonDBChild::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     // TODO: Check because I replaced creation of a cloned infocom by $this
     if (isset($input['warranty_duration'])) {
         $input['_warranty_duration'] = $this->fields['warranty_duration'];
     }
     //Check if one or more dates needs to be updated
     foreach (self::getAutoManagemendDatesFields() as $key => $field) {
         $result = Entity::getUsedConfig($key, $this->fields['entities_id']);
         //Only update date if it's empty in DB. Otherwise do nothing
         if ($result > 0 && !isset($this->fields[$field])) {
             self::autofillDates($input, $field, $result);
         }
     }
     return parent::prepareInputForUpdate($input);
 }
예제 #3
0
 function prepareInputForUpdate($input)
 {
     $job = new Ticket();
     $forbid_fields = array();
     if ($this->fields["users_id_validate"] == Session::getLoginUserID()) {
         if ($input["status"] == "rejected" && (!isset($input["comment_validation"]) || $input["comment_validation"] == '')) {
             Session::addMessageAfterRedirect(__('If approval is denied, specify a reason.'), false, ERROR);
             return false;
         }
         if ($input["status"] == "waiting") {
             //             $input["comment_validation"] = '';
             $input["validation_date"] = 'NULL';
         } else {
             $input["validation_date"] = $_SESSION["glpi_currenttime"];
         }
         $forbid_fields = array('entities_id', 'users_id', 'tickets_id', 'users_id_validate', 'comment_submission', 'submission_date');
     } else {
         if (Session::haveRight('create_incident_validation', 1) || Session::haveRight('create_request_validation', 1)) {
             // Update validation request
             $forbid_fields = array('entities_id', 'tickets_id', 'status', 'comment_validation', 'validation_date');
         }
     }
     if (count($forbid_fields)) {
         foreach ($forbid_fields as $key => $val) {
             if (isset($input[$key])) {
                 unset($input[$key]);
             }
         }
     }
     return parent::prepareInputForUpdate($input);
 }
예제 #4
0
 /**
  * @see CommonDBChild::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     return parent::prepareInputForUpdate($this->prepareInput($input));
 }
 function prepareInputForUpdate($input)
 {
     return parent::prepareInputForUpdate(self::cleanContentHtml($input));
 }
예제 #6
0
 /**
  * @see CommonDBChild::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     $item = 0;
     if (isset($input['_item'])) {
         $item = $_POST['_item'];
     }
     // Save fields
     $oldfields = $this->fields;
     // Needed for test already planned
     if (isset($input["begin"])) {
         $this->fields["begin"] = $input["begin"];
     }
     if (isset($input["end"])) {
         $this->fields["end"] = $input["end"];
     }
     if (!$this->test_valid_date()) {
         $this->displayError("date", $item);
         return false;
     }
     if ($this->is_reserved()) {
         $this->displayError("is_res", $item);
         return false;
     }
     // Restore fields
     $this->fields = $oldfields;
     return parent::prepareInputForUpdate($input);
 }
예제 #7
0
 /**
  * @see CommonDBChild::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     //Check if one or more dates needs to be updated
     foreach (self::getAutoManagemendDatesFields() as $key => $field) {
         $result = Entity::getUsedConfig($key, $this->fields['entities_id']);
         //Only update date if it's empty in DB. Otherwise do nothing
         if ($result > 0 && !isset($this->fields[$field])) {
             self::autofillDates($input, $field, $result);
         }
     }
     return parent::prepareInputForUpdate($input);
 }
예제 #8
0
 function prepareInputForUpdate($input)
 {
     $forbid_fields = array();
     if ($this->fields["users_id_validate"] == Session::getLoginUserID()) {
         if ($input["status"] == self::REFUSED && (!isset($input["comment_validation"]) || $input["comment_validation"] == '')) {
             Session::addMessageAfterRedirect(__('If approval is denied, specify a reason.'), false, ERROR);
             return false;
         }
         if ($input["status"] == self::WAITING) {
             //             $input["comment_validation"] = '';
             $input["validation_date"] = 'NULL';
         } else {
             $input["validation_date"] = $_SESSION["glpi_currenttime"];
         }
         $forbid_fields = array('entities_id', 'users_id', static::$items_id, 'users_id_validate', 'comment_submission', 'submission_date', 'is_recursive');
     } else {
         if (Session::haveRightsOr(static::$rightname, $this->getCreateRights())) {
             // Update validation request
             $forbid_fields = array('entities_id', static::$items_id, 'status', 'comment_validation', 'validation_date', 'is_recursive');
         }
     }
     if (count($forbid_fields)) {
         foreach ($forbid_fields as $key => $val) {
             if (isset($input[$key])) {
                 unset($input[$key]);
             }
         }
     }
     return parent::prepareInputForUpdate($input);
 }