diff --git a/ChangeLog b/ChangeLog index 567c3eaf542c3bb339555a8409d75e7b41ebc4ac..bcc4a9ad66c91fedd8aae5806714e624bd40d609 100644 --- a/ChangeLog +++ b/ChangeLog @@ -222,7 +222,8 @@ Dolibarr better: - Method select_PriceBaseType and load_PriceBaseType were merged into selectPriceBaseType. - The triggers USER_LOGIN* are deprecated. They are still working but you should prefer use the hook afterLogin or afterLoginFailed instead. - +- The trigger USER_CREATE_FROM_CONTACT has been replace with USER_CREATE and property context is now filled + to make difference between creation from contact or not. ***** ChangeLog for 3.7.2 compared to 3.7.1 ***** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bb031b0a8dedffb7d56158d487a6cb5e004d498f..5bc08cab73981f5b8adea2ebae8ca3b751a1c0e7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3532,7 +3532,8 @@ abstract class CommonObject /** - * Call trigger based on this instance + * Call trigger based on this instance. + * Some context information may also be provided into array property this->context. * NB: Error from trigger are stacked in interface->errors * NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction. * diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 199c342020de6feb74cad4f525d966a05b323ada..7b233a4fff8efa3b876059acd097c23913c7ee85 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -50,7 +50,7 @@ class Interfaces * This function call all qualified triggers. * * @param string $action Trigger event code - * @param object $object Objet concern + * @param object $object Objet concerned. Some context information may also be provided into array property object->context. * @param User $user Objet user * @param Lang $langs Objet lang * @param Conf $conf Objet conf diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index 99a8a152384188ade9678de301600b2cda1299d2..fd4d59538f38887caf63ccfe6c66b35baed1d5f5 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -48,7 +48,7 @@ class InterfaceDemo extends DolibarrTriggers * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code - * @param Object $object Object + * @param Object $object Object concerned. Some context information may also be provided into array property object->context. * @param User $user Object user * @param Translate $langs Object langs * @param conf $conf Object conf @@ -62,24 +62,18 @@ class InterfaceDemo extends DolibarrTriggers switch ($action) { // Users - case 'USER_LOGIN': - case 'USER_UPDATE_SESSION': - case 'USER_CREATE': - case 'USER_CREATE_FROM_CONTACT': - case 'USER_LOGIN': - // Warning: To increase performances, this action is triggered only if - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - case 'USER_UPDATE_SESSION': case 'USER_CREATE': - case 'USER_CREATE_FROM_CONTACT': case 'USER_MODIFY': case 'USER_NEW_PASSWORD': case 'USER_ENABLEDISABLE': case 'USER_DELETE': - case 'USER_LOGOUT': case 'USER_SETINGROUP': case 'USER_REMOVEFROMGROUP': + case 'USER_LOGIN': + case 'USER_LOGIN_FAILED': + case 'USER_LOGOUT': + // Actions case 'ACTION_MODIFY': case 'ACTION_CREATE': @@ -208,8 +202,12 @@ class InterfaceDemo extends DolibarrTriggers case 'PAYMENT_SUPPLIER_CREATE': case 'PAYMENT_ADD_TO_BANK': case 'PAYMENT_DELETE': - - //Donation + + // Online + case 'PAYMENT_PAYBOX_OK': + case 'PAYMENT_PAYPAL_OK': + + // Donation case 'DON_CREATE': case 'DON_UPDATE': case 'DON_DELETE': diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f40f47adb80eeed870775393730663ad03cdb2b7..ce2c7987aa5b204ec04c9ba6711cbd0d79b0fb21 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -978,8 +978,10 @@ class User extends CommonObject dol_syslog(get_class($this)."::create_from_contact", LOG_DEBUG); if ($resql) { + $this->context['createfromcontact']='createfromcontact'; + // Call trigger - $result=$this->call_trigger('USER_CREATE_FROM_CONTACT',$user); + $result=$this->call_trigger('USER_CREATE',$user); if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers