Module development: Difference between revisions

Jump to navigation Jump to search
Line 23: Line 23:
= [[File:Art.png]] Create your module =
= [[File:Art.png]] Create your module =
== Create a descriptor of Module (required) ==
== Create a descriptor of Module (required) ==
'''When''': Required as soon as an addon is developed, whatever is its goal (except for adding a skin or a document template).
'''When''': Required as soon as an addon is developed, whatever its goal is (except for adding a skin or a document template).


=== Create your module descriptor ===
=== Create your module descriptor ===
The first step is to create a file descriptor for the module.  
The first step is to create a file descriptor for the module.  
* Create directory '''/htdocs/''mymodule''/core/modules'''. Then go into the directory dev/skeletons and copy the file modMyModule.class.php in this directory '''htdocs/''mymodyle''/core/modules'''.
* Create directory '''/htdocs/''mymodule''/core/modules'''. Then go into the directory dev/skeletons and copy the file modMyModule.class.php in this directory '''htdocs/''mymodyle''/core/modules'''.
Then change the contents of this file to replace:
Then change the contents of this file as follows:
* all "modMyModule" with a value which corresponds to the vocation of your module. This value must always start with 'mod' and contains only alpha characters.
* Replace all "modMyModule" with a value which corresponds to the purpose of your module. This value must always start with 'mod' and contains only alpha characters.
* $this->numero = 10000 by a number of free module (Go to '''Home page -> System Information -> Dolibarr -> Modules''' to know id already used by existing modules).
* Change the number in: $this->numero = 10000 by a number to designate module id, the id number must not have been used already (Go to '''Home page -> System Information -> Dolibarr -> Modules''' to know the numbers already used as id number for existing modules).
* Modify any other variables defined in the constructor (see comment in the code skeleton for their meaning).  
* Modify any other variables defined in the constructor (see comment in the code skeleton for their meaning).  
Your file descriptor for your module is ready.
Your file descriptor for your module is ready.
Line 36: Line 36:
=== Test your descriptor ===
=== Test your descriptor ===


Launch Dolibarr and go to page '''Setup->module'''? You must see a new line with your new module and the possibility to activate it or not (browse all the tabs of each category of modules to find it). It's value of $this->special that determines in which tab will be your module.
Launch Dolibarr and go to page '''Setup->module'''? You must see a new line with your new module and the possibility to activate it or not (browse all the tabs of each category of modules to find it). The value of $this->special determines in which tab will be your module.


== Tree of path for new module files (required) ==
== Tree of path for new module files (required) ==
304

edits

Navigation menu