Module development: Difference between revisions

Jump to navigation Jump to search
m
mNo edit summary
Line 59: Line 59:
If your module is designed to manage data of its own, which are not available in the standard version of Dolibarr, it is necessary to define SQL tables to store the data.
If your module is designed to manage data of its own, which are not available in the standard version of Dolibarr, it is necessary to define SQL tables to store the data.


Scripts for creating tables and load data for your own module must be placed in a directory: Create a subdirectory called "sql" into directory of your module (eg htdocs/mymodule/sql) to put the sql scripts that you will create.  
Scripts for creating tables and load data by your own module are saved into a subdirectory called "/mymodule/sql".  


Then check into your descriptor file, into function '''init''' that the line
Then check into your descriptor file, into function '''init''' that the line
Line 69: Line 69:
''Rules to follow:''
''Rules to follow:''
* Add the files about creating tables commands on the principle of a file '''llx_matable.sql''' per table, with a possibly file '''llx_matable.key.sql''' (see existing files in '''install/mysql/tables''' for examples).
* Add the files about creating tables commands on the principle of a file '''llx_matable.sql''' per table, with a possibly file '''llx_matable.key.sql''' (see existing files in '''install/mysql/tables''' for examples).
The recommended type and name of fields are defined into page [[Language_and_development_rules#Table_and_fields_structures]].


* To manage data, you must create a file called '''data.sql''' inside directory '''/mymodule/sql/''' that contains SQL command to add/edit/delete data.
* To manage data, you must create a file called '''data.sql''' inside directory '''/mymodule/sql/''' that contains SQL command to add/edit/delete data.

Navigation menu