Module ModuleBuilder: Difference between revisions

Jump to navigation Jump to search
Tag: 2017 source edit
Line 28: Line 28:
The ModuleBuilder within Dolibarr presents a lot of features designed for the comprehensive management and development of module.
The ModuleBuilder within Dolibarr presents a lot of features designed for the comprehensive management and development of module.


== Creating a new module ==
==Creating a new module==
Click on the "Bug" picto on top right in the menu bar to reach the ModuleBuilder tool.
Click on the "Bug" picto on top right in the menu bar to reach the ModuleBuilder tool.


Line 36: Line 36:
First files to have a working module will be generated. You can already enable and disable your module from the common page to enabled/disable module of Dolibarr. However, it is recommended to work on the other steps of development of your module, with the module not enabled.
First files to have a working module will be generated. You can already enable and disable your module from the common page to enabled/disable module of Dolibarr. However, it is recommended to work on the other steps of development of your module, with the module not enabled.


== Work on your new module ==
==Work on your new module==


===Language Support===
===Language Support===
Line 59: Line 59:
===Object===
===Object===


*To add an object, simply enter the name, choose an icon, and specify the name of an existing table, if nothing is specified, it creates a new table
*To add an object, simply enter the name, choose an icon, and specify the name of an existing table, if nothing is specified, it creates a new table.
*The three check-boxes depend on your preference: one for enabling automatic numbering generation, the second for enabling PDF document creation, and the third to generate permissions for this object.
*The three check-boxes depend on your preference: one for enabling automatic numbering generation, the second for enabling PDF document creation, and the third to generate permissions for the object created.


<br />
<br />
Line 66: Line 66:




In the description of an object within a Dolibarr module developed using ModuleBuilder, several essential components and functionalities are outlined. These include:
In the description of an object within a Dolibarr module developed using ModuleBuilder, several essential components and functionalities are outlined. These include :  


*'''PHP DAO CRUD Class''': This is the core PHP class that handles database operations such as create, read, update, and delete for the object, ensuring seamless data management.
*'''PHP DAO CRUD Class''': This is the core PHP class that handles database operations such as create, read, update, and delete for the object, ensuring seamless data management.
*'''Icon Representation''': An icon specified for visual representation of the object in the user interface, aiding in quick identification.
*'''Icon Representation''': An icon specified for visual representation of the object in the user interface, aiding in quick identification.
*'''Module API''': Defines the application programming interface for the module, enabling external interactions and integrations.
*'''Module API''': Defines the application programming interface for the module, enabling external interactions and integrations.(one file contain CRUD methods for each object created).
*'''Unit Testing''': A set of PHP unit tests designed to verify the functionality and reliability of the object, ensuring robust operation.
*'''Unit Testing''': A set of PHP unit tests designed to verify the functionality and reliability of the object, ensuring robust operation.
*'''Library Files''': Comprise both a common library file for module-wide functions and an object-specific library file, which includes functions unique to the object's logic and operations.
*'''Library Files''': Comprise both a common library file for module-wide functions and an object-specific library file, which includes functions unique to the object's logic and operations.
Line 118: Line 118:
[[File:AddDictionnaire.png|center|thumb|1485x1485px|Add dictionary ]]
[[File:AddDictionnaire.png|center|thumb|1485x1485px|Add dictionary ]]


=== Hooks===
===Hooks===


* Define in the <code>module_parts['hooks']</code> property within the module descriptor the contexts in which the hooks should be executed (the list of contexts can be found by searching for 'initHooks(' in the core code). Then, edit the hook file to add the code for your hooked functions (hookable functions can be found by searching for 'executeHooks' in the core code).  
*Define in the <code>module_parts['hooks']</code> property within the module descriptor the contexts in which the hooks should be executed (the list of contexts can be found by searching for 'initHooks(' in the core code). Then, edit the hook file to add the code for your hooked functions (hookable functions can be found by searching for 'executeHooks' in the core code).
* Click the "+" button to generate the hooks code.
*Click the "+" button to generate the hooks code.


=== Triggers===
===Triggers===


* In a module, the <code>triggers</code> part of the <code>module_parts</code> array indicates whether the module includes its own directory for triggers within Dolibarr's core triggers system, To generate the trigger file, simply use the "+" button provided by the ModuleBuilder interface in triggers section .
*In a module, the <code>triggers</code> part of the <code>module_parts</code> array indicates whether the module includes its own directory for triggers within Dolibarr's core triggers system, To generate the trigger file, simply use the "+" button provided by the ModuleBuilder interface in triggers section .


=== CSS / JS / CLI===
===CSS / JS / CLI===


* '''CSS''' :  Once generated, you can use the file to define custom styles that will be applied to the module's frontend, improving its appearance and user experience. You can specify styles for layout, colors, fonts, and more, ensuring your module aligns with the desired aesthetic and usability standards.
*'''CSS''' :  Once generated, you can use the file to define custom styles that will be applied to the module's frontend, improving its appearance and user experience. You can specify styles for layout, colors, fonts, and more, ensuring your module aligns with the desired aesthetic and usability standards.


* '''JavaScript (JS)''' : After generating a JS file, you can write scripts to handle user interactions, perform validations, manipulate DOM elements.
*'''JavaScript (JS)''' : After generating a JS file, you can write scripts to handle user interactions, perform validations, manipulate DOM elements.


* The '''Command Line Interface (CLI)''' file plays a crucial role in facilitating module interaction via the command line, allowing for the execution of scripts, or functions without a graphical interface. This is particularly useful for automating processes.
*The '''Command Line Interface (CLI)''' file plays a crucial role in facilitating module interaction via the command line, allowing for the execution of scripts, or functions without a graphical interface. This is particularly useful for automating processes.


By utilizing the ModuleBuilder to generate these files, you simplify the initial setup process for incorporating CSS, JS, and CLI functionalities into your module. Each file serves a distinct purpose, contributing to the module's visual design, interactivity, and operational flexibility, ultimately enhancing its overall utility and integration within the Dolibarr ecosystem.
By utilizing the ModuleBuilder to generate these files, you simplify the initial setup process for incorporating CSS, JS, and CLI functionalities into your module. Each file serves a distinct purpose, contributing to the module's visual design, interactivity, and operational flexibility, ultimately enhancing its overall utility and integration within the Dolibarr ecosystem.
48

edits

Navigation menu