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 mod MyModule are values found in directory
+
Note: Value you can use for modMyModule are values found in directory
−
''htdocs/includes/modules''.
+
''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/includes/triggers/interface_99_modFacture_Myworkflow.class.php''
+
''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 subdirectly. 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:
+
'''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 ''interface_99_modMyModule_Myworkflow.class.php'' to rename class ''InterfaceMyModuleTriggers'' by ''InterfaceMyworkflow''
+
2) Edit the file ''interface_99_modFacture_Myworkflow.class.php'' to modify its content by changing 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.