diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN index 11503186771..464dd232223 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN @@ -1,5 +1,6 @@ + * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,6 +119,10 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'USER_CREATE_FROM_CONTACT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } elseif ($action == 'USER_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9e91796510e..26660eb09e3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -803,7 +803,7 @@ class User extends CommonObject */ function create_from_contact($contact,$login='') { - global $user,$langs; + global $conf,$user,$langs; // Positionne parametres $this->admin = 0; @@ -829,6 +829,13 @@ class User extends CommonObject dol_syslog("User::create_from_contact sql=".$sql, LOG_DEBUG); if ($resql) { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface = new Interfaces($this->db); + $result = $interface->run_triggers('USER_CREATE_FROM_CONTACT',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + $this->db->commit(); return $this->id; }