diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index de88032906c..894b544470a 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -248,7 +248,7 @@ class Categorie // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_UPDATE',$this,$user,$langs,$conf); + $result=$interface->run_triggers('CATEGORY_MODIFY',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN index d189439bf55..44fda22015a 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN @@ -347,7 +347,7 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } - elseif ($action == 'CATEGORY_UPDATE') + elseif ($action == 'CATEGORY_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } @@ -361,7 +361,7 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } - elseif ($action == 'PROJECT_UPDATE') + elseif ($action == 'PROJECT_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } @@ -375,7 +375,7 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } - elseif ($action == 'TASK_UPDATE') + elseif ($action == 'TASK_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } @@ -389,7 +389,7 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } - elseif ($action == 'TASK_TIMESPENT_UPDATE') + elseif ($action == 'TASK_TIMESPENT_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } diff --git a/htdocs/projet/project.class.php b/htdocs/projet/project.class.php index 5ca2067b373..e248a8377d1 100644 --- a/htdocs/projet/project.class.php +++ b/htdocs/projet/project.class.php @@ -113,6 +113,16 @@ class Project extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet"); $result = $this->id; + + if (! $notrigger) + { + // Call triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PROJECT_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers + } } else { @@ -154,6 +164,16 @@ class Project extends CommonObject dol_syslog("Project::Update sql=".$sql,LOG_DEBUG); if ($this->db->query($sql) ) { + if (! $notrigger) + { + // Call triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PROJECT_MODIFY',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers + } + $result = 0; } else @@ -326,7 +346,7 @@ class Project extends CommonObject * \brief Supprime le projet dans la base * \param Utilisateur */ - function delete($user) + function delete($user, $notrigger=0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet"; $sql.= " WHERE rowid=".$this->id; @@ -335,6 +355,16 @@ class Project extends CommonObject $resql = $this->db->query($sql); if ($resql) { + if (! $notrigger) + { + // Call triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PROJECT_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers + } + return 1; } else