예제 #1
0
 function post_addItem()
 {
     // Update calendar cache
     $cal = new Calendar();
     $cal->updateDurationCache($this->fields['calendars_id']);
     parent::post_addItem();
 }
예제 #2
0
 /**
  * @see CommonDBTM::post_addItem()
  **/
 function post_addItem()
 {
     IPAddress_IPNetwork::addIPAddress($this);
     parent::post_addItem();
 }
예제 #3
0
 function post_addItem()
 {
     global $CFG_GLPI;
     $job = new Ticket();
     $mailsend = false;
     if ($job->getFromDB($this->fields["tickets_id"])) {
         // Set global validation to waiting
         if ($job->fields['global_validation'] == 'accepted' || $job->fields['global_validation'] == 'none') {
             $input['id'] = $this->fields["tickets_id"];
             $input['global_validation'] = 'waiting';
             // to fix lastupdater
             if (isset($this->input['_auto_update'])) {
                 $input['_auto_update'] = $this->input['_auto_update'];
             }
             // to know update by rules
             if (isset($this->input["_rule_process"])) {
                 $input['_rule_process'] = $this->input["_rule_process"];
             }
             // No update ticket notif on ticket add
             if (isset($this->input["_ticket_add"])) {
                 $input['_disablenotif'] = true;
             }
             $job->update($input);
         }
         if ($CFG_GLPI["use_mailing"]) {
             $options = array('validation_id' => $this->fields["id"], 'validation_status' => $this->fields["status"]);
             $mailsend = NotificationEvent::raiseEvent('validation', $job, $options);
         }
         if ($mailsend) {
             $user = new User();
             $user->getFromDB($this->fields["users_id_validate"]);
             $email = $user->getDefaultEmail();
             if (!empty($email)) {
                 //TRANS: %s is the user name
                 Session::addMessageAfterRedirect(sprintf(__('Approval request send to %s'), $user->getName()));
             } else {
                 Session::addMessageAfterRedirect(sprintf(__('The selected user (%s) has no valid email address. The request has been created, without email confirmation.'), $user->getName()), false, ERROR);
             }
         }
     }
     parent::post_addItem();
 }
예제 #4
0
 function post_addItem()
 {
     global $CFG_GLPI;
     if ($CFG_GLPI["use_mailing"]) {
         NotificationEvent::raiseEvent("new", $this);
     }
     parent::post_addItem();
 }
예제 #5
0
 /**
  * @since version 0.84
  *
  * @see CommonDBChild::post_addItem()
  **/
 function post_addItem()
 {
     parent::post_addItem();
     if (isset($this->input['rules_id']) && ($realrule = Rule::getRuleObjectByID($this->input['rules_id']))) {
         $realrule->update(array('id' => $this->input['rules_id'], 'date_mod' => $_SESSION['glpi_currenttime']));
     }
 }
예제 #6
0
 function post_addItem()
 {
     Infocom::cloneItem('CartridgeItem', $this->fields["cartridgeitems_id"], $this->fields['id'], $this->getType());
     parent::post_addItem();
 }
 function post_addItem()
 {
     global $DB;
     // if default is set : unset others for the users
     if (isset($this->fields['is_default']) && $this->fields["is_default"] == 1) {
         $query = "UPDATE " . $this->getTable() . "\n                   SET `is_default` = '0'\n                   WHERE `id` <> '" . $this->fields['id'] . "'\n                         AND `users_id` = '" . $this->fields['users_id'] . "'";
         $DB->query($query);
     }
     parent::post_addItem();
 }
예제 #8
0
 function post_addItem()
 {
     global $CFG_GLPI;
     $item = new static::$itemtype();
     $mailsend = false;
     if ($item->getFromDB($this->fields[static::$items_id])) {
         // Set global validation to waiting
         if ($item->fields['global_validation'] == self::ACCEPTED || $item->fields['global_validation'] == self::NONE) {
             $input['id'] = $this->fields[static::$items_id];
             $input['global_validation'] = self::WAITING;
             // to fix lastupdater
             if (isset($this->input['_auto_update'])) {
                 $input['_auto_update'] = $this->input['_auto_update'];
             }
             // to know update by rules
             if (isset($this->input["_rule_process"])) {
                 $input['_rule_process'] = $this->input["_rule_process"];
             }
             // No update ticket notif on ticket add
             if (isset($this->input["_ticket_add"])) {
                 $input['_disablenotif'] = true;
             }
             $item->update($input);
         }
         if ($CFG_GLPI["use_mailing"]) {
             $options = array('validation_id' => $this->fields["id"], 'validation_status' => $this->fields["status"]);
             $mailsend = NotificationEvent::raiseEvent('validation', $item, $options);
         }
         if ($mailsend) {
             $user = new User();
             $user->getFromDB($this->fields["users_id_validate"]);
             $email = $user->getDefaultEmail();
             if (!empty($email)) {
                 $message[] = sprintf(__('Approval request send to %s'), $user->getName());
             } else {
                 $error[] = sprintf(__('The selected user (%s) has no valid email address. The request has been created, without email confirmation.'), $user->getName());
             }
         }
     }
     parent::post_addItem();
 }