Update interface_99_modMyModule_MyModuleTriggers.class.php
This commit is contained in:
parent
4cbe8d8623
commit
a32456afc5
@ -102,12 +102,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
|||||||
// Put here code you want to execute when a Dolibarr business events occurs.
|
// Put here code you want to execute when a Dolibarr business events occurs.
|
||||||
// Data and type of action are stored into $object and $action
|
// Data and type of action are stored into $object and $action
|
||||||
|
|
||||||
/**
|
// You can isolate code for each action in a separate method: this method should be named like the trigger in camelCase.
|
||||||
* new method to handle triggers
|
// For example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf)
|
||||||
* you can now create a method for the interface
|
|
||||||
* this method should be named like the trigger in camelCase
|
|
||||||
* for example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf)
|
|
||||||
*/
|
|
||||||
$methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action)))));
|
$methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action)))));
|
||||||
$callback = array($this, $methodName);
|
$callback = array($this, $methodName);
|
||||||
if (is_callable($callback)){
|
if (is_callable($callback)){
|
||||||
@ -118,6 +114,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
|||||||
return call_user_func($callback, $action, $object, $user, $langs, $conf);
|
return call_user_func($callback, $action, $object, $user, $langs, $conf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Or you can execute some code here
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
// Users
|
// Users
|
||||||
//case 'USER_CREATE':
|
//case 'USER_CREATE':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user