Module development: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
Line 13: Line 13:




= Create a descriptor of Module (required) =
= [[File:Art.png]] Create a descriptor of Module (required) =
'''When''': Required as soon as an addon is developped, whatever is its goal.
'''When''': Required as soon as an addon is developped, whatever is its goal.


Line 32: Line 32:
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). It's value of $this->special that determines in which tab will be your module.


= Create your SQL tables and the PHP accessor class (optionnal) =
= [[File:Art.png]] Create your SQL tables and the PHP accessor class (optionnal) =
'''When''': If your module needs to manage data of its own
'''When''': If your module needs to manage data of its own


Line 73: Line 73:
A file '''out.tablename_script.php''' has been generated and contains a sample code to use the class for each of the 4 CRUD methods.
A file '''out.tablename_script.php''' has been generated and contains a sample code to use the class for each of the 4 CRUD methods.


= Add your own tabs on entities sheets (optionnal) =
= [[File:Art.png]] Add your own tabs on entities sheets (optionnal) =
'''When''': To add a tab on an entity (invoices, orders, proposals, member ...)
'''When''': To add a tab on an entity (invoices, orders, proposals, member ...)


Line 111: Line 111:
To feed the contents of the tab with data from the database, see the next chapter.
To feed the contents of the tab with data from the database, see the next chapter.


= Create your own PHP screens (optionnal) =
= [[File:Art.png]] Create your own PHP screens (optionnal) =
'''When''': If the purpose of your module is to add features that require new screens.
'''When''': If the purpose of your module is to add features that require new screens.


Line 199: Line 199:
</pre>
</pre>


= Définir votre page de configuration (optionnel)  =
= [[File:Art.png]] Définir votre page de configuration (optionnel)  =
'''Quand''': Si votre module offre plusieurs options paramétrables.
'''Quand''': Si votre module offre plusieurs options paramétrables.


Line 215: Line 215:
Aller sur la page '''Configuration->module''', vous devez voir apparaitre un icone qui permet d'accéder à la page de configuratione tvous devez etre capable de modifier ces options et les voir conservé en base.
Aller sur la page '''Configuration->module''', vous devez voir apparaitre un icone qui permet d'accéder à la page de configuratione tvous devez etre capable de modifier ces options et les voir conservé en base.


= Define your entries in menu (optionnal) =
= [[File:Art.png]] Define your entries in menu (optionnal) =
'''When''': If you have created PHP pages, it is necessary that those pages can be reached from menu entries in Dolibarr menu.
'''When''': If you have created PHP pages, it is necessary that those pages can be reached from menu entries in Dolibarr menu.


Line 294: Line 294:
</pre>
</pre>


= Définir vos propres box (optionnel) =
= [[File:Art.png]] Définir vos propres box (optionnel) =
'''Quand''': Si votre module amène avec lui une ou plusieurs Boxes.
'''Quand''': Si votre module amène avec lui une ou plusieurs Boxes.


Line 327: Line 327:
Choisir quelques champs et tenter une génération du fichier export.
Choisir quelques champs et tenter une génération du fichier export.


= Définir vos styles CSS (optionnel) =
= [[File:Art.png]] Définir vos styles CSS (optionnel) =
'''Quand''': Si dans vos écrans PHP, vous utiliser des classes de styles qui ne sont pas celle des thèmes de Dolibarr (non recommandé).
'''Quand''': Si dans vos écrans PHP, vous utiliser des classes de styles qui ne sont pas celle des thèmes de Dolibarr (non recommandé).


Line 344: Line 344:
Vous devriez voir dans l'entête HTML, une ligne déclarant votre feuille de style.
Vous devriez voir dans l'entête HTML, une ligne déclarant votre feuille de style.


= Définir vos fonctions Javascript (optionnel) =
= [[File:Art.png]] Définir vos fonctions Javascript (optionnel) =
'''Quand''': Si dans vos écrans PHP, vous utiliser des fonctions javascript non dispo en standard (fichier lib_head.js)
'''Quand''': Si dans vos écrans PHP, vous utiliser des fonctions javascript non dispo en standard (fichier lib_head.js)


Line 352: Line 352:
Cette fonctionnalité n'est pas encore possible.
Cette fonctionnalité n'est pas encore possible.


= Déclencher du code sur un évènement Dolibarr (optionnel) =
= [[File:Art.png]] Déclencher du code sur un évènement Dolibarr (optionnel) =
'''Quand''': Si vous voulez que des actions particulières s'exécutent suite au déclenchement d'action s standards de Dolibarr (exemple: je veux mettre à jour une table de mon module quand une facture se crée dans Dolibarr), il vous faut créer un fichier de '''triggers'''.
'''Quand''': Si vous voulez que des actions particulières s'exécutent suite au déclenchement d'action s standards de Dolibarr (exemple: je veux mettre à jour une table de mon module quand une facture se crée dans Dolibarr), il vous faut créer un fichier de '''triggers'''.


Line 358: Line 358:
et [http://www.dolibarr.com/wikidev/index.php/Interfaces_Exterieur_vers_Dolibarr Interfaces_Exterieur_vers_Dolibarr]
et [http://www.dolibarr.com/wikidev/index.php/Interfaces_Exterieur_vers_Dolibarr Interfaces_Exterieur_vers_Dolibarr]


= Create a package to distribute and install your module =
= [[File:Art.png]] Create a package to distribute and install your module =


* Go into the directory '''/build''' and copy the file '''makepack-dolibarrmodules.conf''' into '''makepack-mymodule.conf'''. Warning, this directory may not be provided in some packages of stable versions. If so, it can be retrieved from the CVS snapshot available for download on the Dolibarr website in area "Development version" (taken in this case the whole build directory which is autonomous and independent directory).
* Go into the directory '''/build''' and copy the file '''makepack-dolibarrmodules.conf''' into '''makepack-mymodule.conf'''. Warning, this directory may not be provided in some packages of stable versions. If so, it can be retrieved from the CVS snapshot available for download on the Dolibarr website in area "Development version" (taken in this case the whole build directory which is autonomous and independent directory).
Line 379: Line 379:
** If quality is enough and license permits it, code might be added inside main Dolibarr sources (except if you disagree for that).
** If quality is enough and license permits it, code might be added inside main Dolibarr sources (except if you disagree for that).


= Some coding rules =
= [[File:Art.png]] Some coding rules =
The coding rules to be followed are defined in the [[Developer documentation]], under section "General Information - Language and standards development".
The coding rules to be followed are defined in the [[Developer documentation]], under section "General Information - Language and standards development".


= Using MDA =
= [[File:Art.png]] Using MDA =
A method to generate a functional module from a UML model has been developed. More information on the page [[UML2Dolibarr - Build a module using MDA]].
A method to generate a functional module from a UML model has been developed. More information on the page [[UML2Dolibarr - Build a module using MDA]].

Navigation menu