Repository Access Links:

This URL has Read-Only access.
Statistics
| Branch: | Revision:

dolibarr-module-template / core / modules / modMyModule.class.php @ ef37f43f

History | View | Annotate | Download (20.2 kB)

1
<?php
2
/* <one line to give the program's name and a brief idea of what it does.>
3
 * Copyright (C) <year>  <name of author>
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

    
19
/**
20
 * \defgroup    mymodule    MyModule module
21
 * \brief       MyModule module descriptor.
22
 *
23
 * Put detailed description here.
24
 */
25

    
26
/**
27
 * \file        core/modules/modMyModule.class.php
28
 * \ingroup     mymodule
29
 * \brief       Example module description and activation file.
30
 *
31
 * Put detailed description here.
32
 */
33

    
34
include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
35

    
36
// The class name should start with a lower case mod for Dolibarr to pick it up
37
// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule.
38
// @codingStandardsIgnoreStart
39
/**
40
 * Description and activation class for module MyModule
41
 */
42
class modMyModule extends DolibarrModules
43
{
44
        // @codingStandardsIgnoreEnd
45
        /**
46
         * Constructor. Define names, constants, directories, boxes, permissions
47
         *
48
         * @param DoliDB $db Database handler
49
         */
50
        public function __construct($db)
51
        {
52
                global $langs, $conf;
53

    
54
                // DolibarrModules is abstract in Dolibarr < 3.8
55
                if (is_callable('parent::__construct')) {
56
                        parent::__construct($db);
57
                } else {
58
                        $this->db = $db;
59
                }
60

    
61
                // Id for module (must be unique).
62
                // Use a free id here
63
                // (See http://wiki.dolibarr.org/index.php/List_of_modules_id for available ranges).
64
                $this->numero = 500000;
65
                // Key text used to identify module (for permissions, menus, etc...)
66
                $this->rights_class = 'mymodule';
67

    
68
                // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
69
                // It is used to group modules in module setup page
70
                $this->family = "other";
71
                // Module position in the family
72
                $this->module_position = 500;
73
                // Gives the possibility to the module, to provide his own family info and position of this family
74
                // (Overwrite $this->family and $this->module_position. Avoid this)
75
                //$this->familyinfo = array(
76
                //        'myownfamily' => array(
77
                //                'position' => '001',
78
                //                'label' => $langs->trans("MyOwnFamily")
79
                //        )
80
                //);
81
                // Module label (no space allowed)
82
                // used if translation string 'ModuleXXXName' not found
83
                // (where XXX is value of numeric property 'numero' of module)
84
                $this->name = preg_replace('/^mod/i', '', get_class($this));
85
                // Module description
86
                // used if translation string 'ModuleXXXDesc' not found
87
                // (where XXX is value of numeric property 'numero' of module)
88
                $this->description = "Description of module MyModule";
89
                $this->descriptionlong = "A very long description. Can be a full HTML content";
90
                $this->editor_name = 'My Company';
91
                $this->editor_url = 'http://www.example.com';
92
                // Possible values for version are: 'development', 'experimental' or version
93
                $this->version = 'development';
94
                // Key used in llx_const table to save module status enabled/disabled
95
                // (where MYMODULE is value of property name of module in uppercase)
96
                $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
97
                // Name of image file used for this module.
98
                // If file is in theme/yourtheme/img directory under name object_pictovalue.png
99
                // use this->picto='pictovalue'
100
                // If file is in module/img directory under name object_pictovalue.png
101
                // use this->picto='pictovalue@module'
102
                $this->picto = 'mymodule@mymodule'; // mypicto@mymodule
103
                // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
104
                // for default path (eg: /mymodule/core/xxxxx) (0=disable, 1=enable)
105
                // for specific path of parts (eg: /mymodule/core/modules/barcode)
106
                // for specific css file (eg: /mymodule/css/mymodule.css.php)
107
                $this->module_parts = array(
108
                        // Set this to 1 if module has its own trigger directory
109
                        'triggers' => 1,
110
                        // Set this to 1 if module has its own login method directory
111
                        //'login' => 0,
112
                        // Set this to 1 if module has its own substitution function file
113
                        //'substitutions' => 0,
114
                        // Set this to 1 if module has its own menus handler directory
115
                        //'menus' => 0,
116
                        // Set this to 1 if module has its own theme directory (theme)
117
                        // 'theme' => 0,
118
                        // Set this to 1 if module overwrite template dir (core/tpl)
119
                        // 'tpl' => 0,
120
                        // Set this to 1 if module has its own barcode directory
121
                        //'barcode' => 0,
122
                        // Set this to 1 if module has its own models directory
123
                        //'models' => 0,
124
                        // Set this to relative path of css if module has its own css file
125
                        'css' => array('mymodule/css/mycss.css.php'),
126
                        // Set this to relative path of js file if module must load a js on all pages
127
                        // 'js' => array('mymodule/js/mymodule.js'),
128
                        // Set here all hooks context managed by module
129
                        // 'hooks' => array('hookcontext1','hookcontext2'),
130
                        // To force the default directories names
131
                        // 'dir' => array('output' => 'othermodulename'),
132
                        // Set here all workflow context managed by module
133
                        // Don't forget to depend on modWorkflow!
134
                        // The description translation key will be descWORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2
135
                        // You will be able to check if it is enabled with the $conf->global->WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2 constant
136
                        // Implementation is up to you and is usually done in a trigger.
137
                        // 'workflow' => array(
138
                        //     'WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2' => array(
139
                        //         'enabled' => '! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)',
140
                        //         'picto' => 'yourpicto@mymodule',
141
                        //         'warning' => 'WarningTextTranslationKey',
142
                        //      ),
143
                        // ),
144
                );
145

    
146
                // Data directories to create when module is enabled.
147
                // Example: this->dirs = array("/mymodule/temp");
148
                $this->dirs = array();
149

    
150
                // Config pages. Put here list of php pages
151
                // stored into mymodule/admin directory, used to setup module.
152
                $this->config_page_url = array("setup.php@mymodule");
153

    
154
                // Dependencies
155
                // A condition to hide module
156
                $this->hidden = false;
157
                // List of module class names as string that must be enabled if this module is enabled
158
                // Example : $this->depends('modAnotherModule', 'modYetAnotherModule')
159
                $this->depends = array();
160
                // List of module ids to disable if this one is disabled
161
                $this->requiredby = array();
162
                // List of module class names as string this module is in conflict with
163
                $this->conflictwith = array();
164
                // Minimum version of PHP required by module
165
                $this->phpmin = array(5, 3);
166
                // Minimum version of Dolibarr required by module
167
                $this->need_dolibarr_version = array(3, 2);
168
                // Language files list (langfiles@mymodule)
169
                $this->langfiles = array("mymodule@mymodule");
170
                // Constants
171
                // List of particular constants to add when module is enabled
172
                // (name, type ['chaine' or ?], value, description, visibility, entity ['current' or 'allentities'], delete on unactive)
173
                // Example:
174
                $this->const = array(
175
                        //        0 => array(
176
                        //                'MYMODULE_MYNEWCONST1',
177
                        //                'chaine',
178
                        //                'myvalue',
179
                        //                'This is a constant to add',
180
                        //                1,
181
                        //      'current',
182
                        //      0,
183
                        //        ),
184
                        //        1 => array(
185
                        //                'MYMODULE_MYNEWCONST2',
186
                        //                'chaine',
187
                        //                'myvalue',
188
                        //                'This is another constant to add',
189
                        //                0,
190
                        //        )
191
                );
192

    
193
                // Array to add new pages in new tabs
194
                // Example:
195
                $this->tabs = array(
196
                        //        // To add a new tab identified by code tabname1
197
                        //        'objecttype:+tabname1:Title1:langfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__',
198
                        //        // To add another new tab identified by code tabname2
199
                        //        'objecttype:+tabname2:Title2:langfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__',
200
                        //        // To remove an existing tab identified by code tabname
201
                        //        'objecttype:-tabname'
202
                );
203
                // 'categories_x'          to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
204
                // 'contact'          to add a tab in contact view
205
                // 'contract'         to add a tab in contract view
206
                // 'group'            to add a tab in group view
207
                // 'intervention'     to add a tab in intervention view
208
                // 'invoice'          to add a tab in customer invoice view
209
                // 'invoice_supplier' to add a tab in supplier invoice view
210
                // 'member'           to add a tab in fundation member view
211
                // 'opensurveypoll'          to add a tab in opensurvey poll view
212
                // 'order'            to add a tab in customer order view
213
                // 'order_supplier'   to add a tab in supplier order view
214
                // 'payment'                  to add a tab in payment view
215
                // 'payment_supplier' to add a tab in supplier payment view
216
                // 'product'          to add a tab in product view
217
                // 'propal'           to add a tab in propal view
218
                // 'project'          to add a tab in project view
219
                // 'stock'            to add a tab in stock view
220
                // 'thirdparty'       to add a tab in third party view
221
                // 'user'             to add a tab in user view
222

    
223
                // Dictionaries
224
                if (! isset($conf->mymodule->enabled)) {
225
                        $conf->mymodule=new stdClass();
226
                        $conf->mymodule->enabled = 0;
227
                }
228
                $this->dictionaries = array();
229
                /* Example:
230
                  // This is to avoid warnings
231
                  if (! isset($conf->mymodule->enabled)) $conf->mymodule->enabled=0;
232
                  $this->dictionaries=array(
233
                          'langs'=>'mymodule@mymodule',
234
                          // List of tables we want to see into dictonnary editor
235
                          'tabname'=>array(
236
                                  MAIN_DB_PREFIX."table1",
237
                                  MAIN_DB_PREFIX."table2",
238
                                  MAIN_DB_PREFIX."table3"
239
                          ),
240
                          // Label of tables
241
                          'tablib'=>array("Table1","Table2","Table3"),
242
                          // Request to select fields
243
                          'tabsql'=>array(
244
                                  'SELECT f.rowid as rowid, f.code, f.label, f.active'
245
                                  . ' FROM ' . MAIN_DB_PREFIX . 'table1 as f',
246
                                  'SELECT f.rowid as rowid, f.code, f.label, f.active'
247
                                  . ' FROM ' . MAIN_DB_PREFIX . 'table2 as f',
248
                                  'SELECT f.rowid as rowid, f.code, f.label, f.active'
249
                                  . ' FROM ' . MAIN_DB_PREFIX . 'table3 as f'
250
                          ),
251
                          // Sort order
252
                          'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
253
                          // List of fields (result of select to show dictionary)
254
                          'tabfield'=>array("code,label","code,label","code,label"),
255
                          // List of fields (list of fields to edit a record)
256
                          'tabfieldvalue'=>array("code,label","code,label","code,label"),
257
                          // List of fields (list of fields for insert)
258
                          'tabfieldinsert'=>array("code,label","code,label","code,label"),
259
                          // Name of columns with primary key (try to always name it 'rowid')
260
                          'tabrowid'=>array("rowid","rowid","rowid"),
261
                          // Condition to show each dictionary
262
                          'tabcond'=>array(
263
                                  $conf->mymodule->enabled,
264
                                  $conf->mymodule->enabled,
265
                                  $conf->mymodule->enabled
266
                          )
267
                  );
268
                 */
269

    
270
                // Boxes
271
                // Add here list of php file(s) stored in core/boxes that contains class to show a box.
272
                $this->boxes = array(); // Boxes list
273
                // Example:
274
                $this->boxes = array(
275
                        0 => array(
276
                                'file' => 'mybox@mymodule',
277
                                'note' => '',
278
                                'enabledbydefaulton' => 'Home'
279
                        )
280
                );
281

    
282
                // Cronjobs
283
                // List of cron jobs entries to add
284
                $this->cronjobs = array();
285
                // Example:
286
                //                $this->cronjobs = array(
287
                //                        0 => array(
288
                //                                'label' => 'My label',
289
                //                                'jobtype' => 'method',
290
                //                                'class' => '/dir/class/file.class.php',
291
                //                                'objectname' => 'MyClass',
292
                //                                'method' => 'myMethod',
293
                //                                'parameters' => '',
294
                //                                'comment' => 'Comment',
295
                //                                'frequency' => 2,
296
                //                                'unitfrequency' => 3600,
297
                //                                'test' => true
298
                //                        ),
299
                //                        1 => array(
300
                //                                'label' => 'My label',
301
                //                                'jobtype' => 'command',
302
                //                                'command' => '',
303
                //                                'parameters' => '',
304
                //                                'comment' => 'Comment',
305
                //                                'frequency' => 1,
306
                //                                'unitfrequency' => 3600 * 24,
307
                //                                'test' => true
308
                //                        )
309
                //                );
310

    
311
                // Permissions
312
                $this->rights = array(); // Permission array used by this module
313
                $r = 0;
314

    
315
                // Add here list of permission defined by
316
                // an id, a label, a boolean and two constant strings.
317
                // Example:
318
                //// Permission id (must not be already used)
319
                //$this->rights[$r][0] = 2000;
320
                //// Permission label
321
                //$this->rights[$r][1] = 'Permision label';
322
                //// Permission by default for new user (0/1)
323
                //$this->rights[$r][3] = 1;
324
                //// In php code, permission will be checked by test
325
                //// if ($user->rights->permkey->level1->level2)
326
                //$this->rights[$r][4] = 'level1';
327
                //// In php code, permission will be checked by test
328
                //// if ($user->rights->permkey->level1->level2)
329
                //$this->rights[$r][5] = 'level2';
330
                //$r++;
331
                // Main menu entries
332

    
333
                // Add here entries to declare new menus
334
                //
335
                // Example to declare a new Top Menu entry and its Left menu entry:
336
                //$this->menu[]=array(
337
                //        // Put 0 if this is a top menu
338
                //        'fk_menu'=>0,
339
                //        // This is a Top menu entry
340
                //        'type'=>'top',
341
                // Menu's title. FIXME: use a translation key
342
                //        'titre'=>'MyModule top menu',
343
                // This menu's mainmenu ID
344
                //        'mainmenu'=>'mymodule',
345
                // This menu's leftmenu ID
346
                //        'leftmenu'=>'mymodule',
347
                //        'url'=>'/mymodule/pagetop.php',
348
                //        // Lang file to use (without .lang) by module.
349
                //        // File must be in langs/code_CODE/ directory.
350
                //        'langs'=>'mylangfile',
351
                //        'position'=>100,
352
                //        // Define condition to show or hide menu entry.
353
                //        // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
354
                //        'enabled'=>'$conf->mymodule->enabled',
355
                //        // Use 'perms'=>'$user->rights->mymodule->level1->level2'
356
                //        // if you want your menu with a permission rules
357
                //        'perms'=>'1',
358
                //        'target'=>'',
359
                //        // 0=Menu for internal users, 1=external users, 2=both
360
                //        'user'=>2
361
                //);
362
                //$this->menu[]=array(
363
                //        // Use r=value where r is index key used for the parent menu entry
364
                //        // (higher parent must be a top menu entry)
365
                //        'fk_menu'=>'r=0',
366
                //        // This is a Left menu entry
367
                //        'type'=>'left',
368
                // Menu's title. FIXME: use a translation key
369
                //        'titre'=>'MyModule left menu',
370
                // This menu's mainmenu ID
371
                //        'mainmenu'=>'mymodule',
372
                // This menu's leftmenu ID
373
                //        'leftmenu'=>'mymodule',
374
                //        'url'=>'/mymodule/pagelevel1.php',
375
                //        // Lang file to use (without .lang) by module.
376
                //        // File must be in langs/code_CODE/ directory.
377
                //        'langs'=>'mylangfile',
378
                //        'position'=>100,
379
                //        // Define condition to show or hide menu entry.
380
                //        // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
381
                //        'enabled'=>'$conf->mymodule->enabled',
382
                //        // Use 'perms'=>'$user->rights->mymodule->level1->level2'
383
                //        // if you want your menu with a permission rules
384
                //        'perms'=>'1',
385
                //        'target'=>'',
386
                //        // 0=Menu for internal users, 1=external users, 2=both
387
                //        'user'=>2
388
                //);
389
                //
390
                // Example to declare a Left Menu entry into an existing Top menu entry:
391
                //$this->menu[]=array(
392
                //        // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
393
                //        'fk_menu'=>'fk_mainmenu=mainmenucode',
394
                //        // This is a Left menu entry
395
                //        'type'=>'left',
396
                // Menu's title. FIXME: use a translation key
397
                //        'titre'=>'MyModule left menu',
398
                // This menu's mainmenu ID
399
                //        'mainmenu'=>'mainmenucode',
400
                // This menu's leftmenu ID
401
                //        'leftmenu'=>'mymodule',
402
                //        'url'=>'/mymodule/pagelevel2.php',
403
                //        // Lang file to use (without .lang) by module.
404
                //        // File must be in langs/code_CODE/ directory.
405
                //        'langs'=>'mylangfile',
406
                //        'position'=>100,
407
                //        // Define condition to show or hide menu entry.
408
                //        // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
409
                //        // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
410
                //        'enabled'=>'$conf->mymodule->enabled',
411
                //        // Use 'perms'=>'$user->rights->mymodule->level1->level2'
412
                //        // if you want your menu with a permission rules
413
                //        'perms'=>'1',
414
                //        'target'=>'',
415
                //        // 0=Menu for internal users, 1=external users, 2=both
416
                //        'user'=>2
417
                //);
418

    
419
                // Exports
420
                $r = 0;
421

    
422
                // Example:
423
                //$this->export_code[$r]=$this->rights_class.'_'.$r;
424
                //// Translation key (used only if key ExportDataset_xxx_z not found)
425
                //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
426
                //// Condition to show export in list (ie: '$user->id==3').
427
                //// Set to 1 to always show when module is enabled.
428
                //$this->export_enabled[$r]='1';
429
                //$this->export_permission[$r]=array(array("facture","facture","export"));
430
                //$this->export_fields_array[$r]=array(
431
                //        's.rowid'=>"IdCompany",
432
                //        's.nom'=>'CompanyName',
433
                //        's.address'=>'Address',
434
                //        's.cp'=>'Zip',
435
                //        's.ville'=>'Town',
436
                //        's.fk_pays'=>'Country',
437
                //        's.tel'=>'Phone',
438
                //        's.siren'=>'ProfId1',
439
                //        's.siret'=>'ProfId2',
440
                //        's.ape'=>'ProfId3',
441
                //        's.idprof4'=>'ProfId4',
442
                //        's.code_compta'=>'CustomerAccountancyCode',
443
                //        's.code_compta_fournisseur'=>'SupplierAccountancyCode',
444
                //        'f.rowid'=>"InvoiceId",
445
                //        'f.facnumber'=>"InvoiceRef",
446
                //        'f.datec'=>"InvoiceDateCreation",
447
                //        'f.datef'=>"DateInvoice",
448
                //        'f.total'=>"TotalHT",
449
                //        'f.total_ttc'=>"TotalTTC",
450
                //        'f.tva'=>"TotalVAT",
451
                //        'f.paye'=>"InvoicePaid",
452
                //        'f.fk_statut'=>'InvoiceStatus',
453
                //        'f.note'=>"InvoiceNote",
454
                //        'fd.rowid'=>'LineId',
455
                //        'fd.description'=>"LineDescription",
456
                //        'fd.price'=>"LineUnitPrice",
457
                //        'fd.tva_tx'=>"LineVATRate",
458
                //        'fd.qty'=>"LineQty",
459
                //        'fd.total_ht'=>"LineTotalHT",
460
                //        'fd.total_tva'=>"LineTotalTVA",
461
                //        'fd.total_ttc'=>"LineTotalTTC",
462
                //        'fd.date_start'=>"DateStart",
463
                //        'fd.date_end'=>"DateEnd",
464
                //        'fd.fk_product'=>'ProductId',
465
                //        'p.ref'=>'ProductRef'
466
                //);
467
                //$this->export_entities_array[$r]=array('s.rowid'=>"company",
468
                //        's.nom'=>'company',
469
                //        's.address'=>'company',
470
                //        's.cp'=>'company',
471
                //        's.ville'=>'company',
472
                //        's.fk_pays'=>'company',
473
                //        's.tel'=>'company',
474
                //        's.siren'=>'company',
475
                //        's.siret'=>'company',
476
                //        's.ape'=>'company',
477
                //        's.idprof4'=>'company',
478
                //        's.code_compta'=>'company',
479
                //        's.code_compta_fournisseur'=>'company',
480
                //        'f.rowid'=>"invoice",
481
                //        'f.facnumber'=>"invoice",
482
                //        'f.datec'=>"invoice",
483
                //        'f.datef'=>"invoice",
484
                //        'f.total'=>"invoice",
485
                //        'f.total_ttc'=>"invoice",
486
                //        'f.tva'=>"invoice",
487
                //        'f.paye'=>"invoice",
488
                //        'f.fk_statut'=>'invoice',
489
                //        'f.note'=>"invoice",
490
                //        'fd.rowid'=>'invoice_line',
491
                //        'fd.description'=>"invoice_line",
492
                //        'fd.price'=>"invoice_line",
493
                //        'fd.total_ht'=>"invoice_line",
494
                //        'fd.total_tva'=>"invoice_line",
495
                //        'fd.total_ttc'=>"invoice_line",
496
                //        'fd.tva_tx'=>"invoice_line",
497
                //        'fd.qty'=>"invoice_line",
498
                //        'fd.date_start'=>"invoice_line",
499
                //        'fd.date_end'=>"invoice_line",
500
                //        'fd.fk_product'=>'product',
501
                //        'p.ref'=>'product'
502
                //);
503
                //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
504
                //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
505
                //        . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
506
                //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
507
                //        . 'product as p on (fd.fk_product = p.rowid)';
508
                //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
509
                //        . 'AND f.rowid = fd.fk_facture';
510
                //$r++;
511

    
512
                // Can be enabled / disabled only in the main company when multi-company is in use
513
                // $this->core_enabled = 1;
514
        }
515

    
516
        /**
517
         * Function called when module is enabled.
518
         * The init function add constants, boxes, permissions and menus
519
         * (defined in constructor) into Dolibarr database.
520
         * It also creates data directories
521
         *
522
         * @param string $options Options when enabling module ('', 'noboxes')
523
         * @return int 1 if OK, 0 if KO
524
         */
525
        public function init($options = '')
526
        {
527
                $sql = array();
528

    
529
                $result = $this->loadTables();
530

    
531
                return $this->_init($sql, $options);
532
        }
533

    
534
        /**
535
         * Create tables, keys and data required by module
536
         * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
537
         * and create data commands must be stored in directory /mymodule/sql/
538
         * This function is called by this->init
539
         *
540
         * @return int <=0 if KO, >0 if OK
541
         */
542
        private function loadTables()
543
        {
544
                return $this->_load_tables('/mymodule/sql/');
545
        }
546

    
547
        /**
548
         * Function called when module is disabled.
549
         * Remove from database constants, boxes and permissions from Dolibarr database.
550
         * Data directories are not deleted
551
         *
552
         * @param string $options Options when enabling module ('', 'noboxes')
553
         * @return int 1 if OK, 0 if KO
554
         */
555
        public function remove($options = '')
556
        {
557
                $sql = array();
558

    
559
                return $this->_remove($sql, $options);
560
        }
561
}