31,024
edits
Tag: 2017 source edit |
Tag: 2017 source edit |
||
| Line 32: | Line 32: | ||
This new file must be saved inside same directory. | This new file must be saved inside same directory. | ||
Note: Value you can use for | Note: Value you can use for modMyModule are values found in directory | ||
''htdocs/ | ''htdocs/core/modules''. | ||
'''WARNING''': All those parameters are necessary for the trigger to be detected and executed! Eg: if you forget the priority number, your trigger won't be detected! | '''WARNING''': All those parameters are necessary for the trigger to be detected and executed! Eg: if you forget the priority number, your trigger won't be detected! | ||
For example, you can name your new trigger file: | For example, you can name your new trigger file: | ||
''htdocs/ | ''htdocs/core/triggers/interface_99_modFacture_Myworkflow.class.php'' | ||
By creating such a file with a name like the example, your new trigger file will be executed each time a Dolibarr business event occurs but only if the module Facture is enabled. | By creating such a file with a name like the example, your new trigger file will be executed each time a Dolibarr business event occurs but only if the module Facture is enabled. | ||
'''Note''': If you develop a full module, you can also place the trigger file in your own module's | '''Note''': If you develop a full module, you can also place the trigger file in your own module's sub-directory. Eg: if your module resides in htdocs/mymodule/, then you can place your triggers inside htdocs/mymodule/core/triggers/. But for this, you must declare the trigger into your module descriptor file (eg: '''/mymodule/core/modules/modMyModule.class.php'''). For this, add into this file triggers->1 into module_parts array: | ||
<syntaxhighlight lang="PHP"> | <syntaxhighlight lang="PHP"> | ||
// Defined all module parts (triggers, login, substitutions, menus, etc...) (0=disable,1=enable) | // Defined all module parts (triggers, login, substitutions, menus, etc...) (0=disable,1=enable) | ||
| Line 54: | Line 54: | ||
2) Edit the file '' | 2) Edit the file ''interface_99_modFacture_Myworkflow.class.php'' to rename the class ''InterfaceMyModuleTriggers'' by ''InterfaceMyworkflow:'' | ||
Then go on page Home -> Admin Tools -> About Dolibarr ->Triggers. | Then go on page Home -> Admin Tools -> About Dolibarr ->Triggers. | ||