Ejemplo n.º 1
0
 function post_addItem()
 {
     global $CFG_GLPI;
     $projet_projet = new PluginProjetProjet_Projet();
     // From interface
     if (isset($this->input['_link'])) {
         $this->input['_link']['plugin_projet_projets_id_1'] = $this->fields['id'];
         // message if projet doesn't exist
         if (!empty($this->input['_link']['plugin_projet_projets_id_2'])) {
             if ($projet_projet->can(-1, 'w', $this->input['_link'])) {
                 $projet_projet->add($this->input['_link']);
             } else {
                 Session::addMessageAfterRedirect(__('Unknown project', 'projet'), false, ERROR);
             }
         }
     }
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         //add parent
         PluginProjetProjet_Projet::cloneItem($this->input["_oldID"], $this->fields['id']);
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Contracts
         Contract_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD items
         PluginProjetProjet_Item::cloneItem($this->input["_oldID"], $this->fields['id']);
         // ADD tasks
         PluginProjetTask::cloneItem($this->input["_oldID"], $this->fields['id']);
     }
     if (isset($this->input['withtemplate']) && $this->input["withtemplate"] != 1 && isset($this->input['send_notification']) && $this->input['send_notification'] == 1) {
         if ($CFG_GLPI["use_mailing"]) {
             NotificationEvent::raiseEvent("new", $this);
         }
     }
 }