Changes

Jump to navigation Jump to search
m
Line 53: Line 53:  
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 of your own module must be placed in a directory.
+
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.  
   −
Create a subdirectory called "sql" into directory of your module (eg htdocs/mymodule/sql) to put the sql scripts that you will create. Then in the "load_tables" function of your file descriptor module, modify the line
+
Then check into your descriptor file, into function init that the line
   −
<source lang="php">$dir = DOL_DOCUMENT_ROOT.'/mymodule/sql/';</source>
+
<source lang="php">$this->_load_tables('/mymodule/sql/');</source>
by
+
 
<source lang="php">$dir = DOL_DOCUMENT_ROOT.'/valuechooseformymodule/sql/';</source>
+
is not commented.
    
''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).
    
* 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