modEventOrganization.class.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <?php
  2. /* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \defgroup eventorganization Module EventOrganization
  19. * \brief EventOrganization module descriptor.
  20. *
  21. * \file htdocs/eventorganization/core/modules/modEventOrganization.class.php
  22. * \ingroup eventorganization
  23. * \brief Description and activation file for the EventOrganization
  24. */
  25. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  26. /**
  27. * Description and activation class for module EventOrganization
  28. * This module is base on this specification :
  29. * https://wiki.dolibarr.org/index.php/Draft:Module_Event_Organization
  30. */
  31. class modEventOrganization extends DolibarrModules
  32. {
  33. /**
  34. * Constructor. Define names, constants, directories, boxes, permissions
  35. *
  36. * @param DoliDB $db Database handler
  37. */
  38. public function __construct($db)
  39. {
  40. global $langs, $conf;
  41. $this->db = $db;
  42. $this->numero = 2450;
  43. $this->rights_class = 'eventorganization';
  44. $this->family = "projects";
  45. $this->module_position = '20';
  46. $this->name = preg_replace('/^mod/i', '', get_class($this));
  47. $this->description = "EventOrganizationDescription";
  48. $this->descriptionlong = "EventOrganizationDescriptionLong";
  49. $this->version = 'development';
  50. // Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase)
  51. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  52. $this->picto = 'action';
  53. // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
  54. $this->module_parts = array(
  55. // Set this to 1 if module has its own trigger directory (core/triggers)
  56. 'triggers' => 1,
  57. // Set this to 1 if module has its own login method file (core/login)
  58. 'login' => 0,
  59. // Set this to 1 if module has its own substitution function file (core/substitutions)
  60. 'substitutions' => 0,
  61. // Set this to 1 if module has its own menus handler directory (core/menus)
  62. 'menus' => 0,
  63. // Set this to 1 if module overwrite template dir (core/tpl)
  64. 'tpl' => 0,
  65. // Set this to 1 if module has its own barcode directory (core/modules/barcode)
  66. 'barcode' => 0,
  67. // Set this to 1 if module has its own models directory (core/modules/xxx)
  68. 'models' => 1,
  69. // Set this to 1 if module has its own printing directory (core/modules/printing)
  70. 'printing' => 0,
  71. // Set this to 1 if module has its own theme directory (theme)
  72. 'theme' => 0,
  73. // Set this to relative path of css file if module has its own css file
  74. 'css' => array(
  75. // '/eventorganization/css/eventorganization.css.php',
  76. ),
  77. // Set this to relative path of js file if module must load a js on all pages
  78. 'js' => array(
  79. // '/eventorganization/js/eventorganization.js.php',
  80. ),
  81. // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
  82. 'hooks' => array(
  83. // 'data' => array(
  84. // 'hookcontext1',
  85. // 'hookcontext2',
  86. // ),
  87. // 'entity' => '0',
  88. ),
  89. // Set this to 1 if features of module are opened to external users
  90. 'moduleforexternal' => 0,
  91. );
  92. // Data directories to create when module is enabled.
  93. // Example: this->dirs = array("/eventorganization/temp","/eventorganization/subdir");
  94. $this->dirs = array("/eventorganization/temp");
  95. // Config pages. Put here list of php page, stored into eventorganization/admin directory, to use to setup module.
  96. $this->config_page_url = array("eventorganization.php");
  97. // Dependencies
  98. // A condition to hide module
  99. $this->hidden = false;
  100. // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
  101. $this->depends = array('modProjet','modCategorie');
  102. $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
  103. $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
  104. // The language file dedicated to your module
  105. $this->langfiles = array("eventorganization");
  106. // Prerequisites
  107. $this->phpmin = array(5, 6); // Minimum version of PHP required by module
  108. $this->need_dolibarr_version = array(13, -3); // Minimum version of Dolibarr required by module
  109. // Messages at activation
  110. $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
  111. $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
  112. //$this->automatic_activation = array('FR'=>'EventOrganizationWasAutomaticallyActivatedBecauseOfYourCountryChoice');
  113. //$this->always_enabled = true; // If true, can't be disabled
  114. // Constants
  115. // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
  116. // Example: $this->const=array(1 => array('EVENTORGANIZATION_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
  117. // 2 => array('EVENTORGANIZATION_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
  118. // );
  119. $this->const = array(1 => array('EVENTORGANIZATION_TASK_LABEL', 'chaine', '', '', 0));
  120. // Some keys to add into the overwriting translation tables
  121. /*$this->overwrite_translation = array(
  122. 'en_US:ParentCompany'=>'Parent company or reseller',
  123. 'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
  124. )*/
  125. if (!isset($conf->eventorganization) || !isset($conf->eventorganization->enabled)) {
  126. $conf->eventorganization = new stdClass();
  127. $conf->eventorganization->enabled = 0;
  128. }
  129. // Array to add new pages in new tabs
  130. $this->tabs = array();
  131. // Example:
  132. // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@eventorganization:$user->rights->eventorganization->read:/eventorganization/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
  133. // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@eventorganization:$user->rights->othermodule->read:/eventorganization/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
  134. // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
  135. //
  136. // Where objecttype can be
  137. // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
  138. // 'contact' to add a tab in contact view
  139. // 'contract' to add a tab in contract view
  140. // 'group' to add a tab in group view
  141. // 'intervention' to add a tab in intervention view
  142. // 'invoice' to add a tab in customer invoice view
  143. // 'invoice_supplier' to add a tab in supplier invoice view
  144. // 'member' to add a tab in fundation member view
  145. // 'opensurveypoll' to add a tab in opensurvey poll view
  146. // 'order' to add a tab in customer order view
  147. // 'order_supplier' to add a tab in supplier order view
  148. // 'payment' to add a tab in payment view
  149. // 'payment_supplier' to add a tab in supplier payment view
  150. // 'product' to add a tab in product view
  151. // 'propal' to add a tab in propal view
  152. // 'project' to add a tab in project view
  153. // 'stock' to add a tab in stock view
  154. // 'thirdparty' to add a tab in third party view
  155. // 'user' to add a tab in user view
  156. // Dictionaries
  157. $this->dictionaries = array();
  158. /* Example:
  159. $this->dictionaries=array(
  160. 'langs'=>'eventorganization@eventorganization',
  161. // List of tables we want to see into dictonnary editor
  162. 'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"),
  163. // Label of tables
  164. 'tablib'=>array("Table1", "Table2", "Table3"),
  165. // Request to select fields
  166. 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
  167. // Sort order
  168. 'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
  169. // List of fields (result of select to show dictionary)
  170. 'tabfield'=>array("code,label", "code,label", "code,label"),
  171. // List of fields (list of fields to edit a record)
  172. 'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
  173. // List of fields (list of fields for insert)
  174. 'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
  175. // Name of columns with primary key (try to always name it 'rowid')
  176. 'tabrowid'=>array("rowid", "rowid", "rowid"),
  177. // Condition to show each dictionary
  178. 'tabcond'=>array($conf->eventorganization->enabled, $conf->eventorganization->enabled, $conf->eventorganization->enabled)
  179. );
  180. */
  181. // Boxes/Widgets
  182. // Add here list of php file(s) stored in eventorganization/core/boxes that contains a class to show a widget.
  183. $this->boxes = array(
  184. // 0 => array(
  185. // 'file' => 'eventorganizationwidget1.php@eventorganization',
  186. // 'note' => 'Widget provided by EventOrganization',
  187. // 'enabledbydefaulton' => 'Home',
  188. // ),
  189. // ...
  190. );
  191. // Cronjobs (List of cron jobs entries to add when module is enabled)
  192. // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
  193. $this->cronjobs = array(
  194. );
  195. // Permissions provided by this module
  196. $this->rights = array();
  197. $r = 1;
  198. // Add here entries to declare new permissions
  199. /* BEGIN MODULEBUILDER PERMISSIONS */
  200. $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
  201. $this->rights[$r][1] = 'Read objects of EventOrganization'; // Permission label
  202. $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
  203. $r++;
  204. $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
  205. $this->rights[$r][1] = 'Create/Update objects of EventOrganization'; // Permission label
  206. $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
  207. $r++;
  208. $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
  209. $this->rights[$r][1] = 'Delete objects of EventOrganization'; // Permission label
  210. $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
  211. $r++;
  212. /* END MODULEBUILDER PERMISSIONS */
  213. // Main menu entries to add
  214. $this->menu = array();
  215. $r = 0;
  216. // Add here entries to declare new menus
  217. /* BEGIN MODULEBUILDER TOPMENU */
  218. /* END MODULEBUILDER TOPMENU */
  219. /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/
  220. $this->menu[$r++]=array(
  221. 'fk_menu'=>'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  222. 'type'=>'left', // This is a Left menu entry
  223. 'titre'=>'EventOrganizationMenuLeft',
  224. 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'),
  225. 'mainmenu'=>'project',
  226. 'leftmenu'=>'eventorganization',
  227. 'url'=>'',
  228. 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  229. 'position'=>1000+$r,
  230. 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  231. 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
  232. 'target'=>'',
  233. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  234. );
  235. $this->menu[$r++]=array(
  236. 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  237. 'type'=>'left', // This is a Left menu entry
  238. 'titre'=>'List',
  239. 'url'=>'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
  240. 'langs'=>'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  241. 'position'=>1000+$r,
  242. 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  243. 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
  244. 'target'=>'',
  245. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  246. );
  247. $this->menu[$r++]=array(
  248. 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  249. 'type'=>'left', // This is a Left menu entry
  250. 'titre'=>'New',
  251. 'url'=>'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1',
  252. 'langs'=>'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  253. 'position'=>1000+$r,
  254. 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  255. 'perms'=>'$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
  256. 'target'=>'',
  257. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  258. );
  259. $this->menu[$r++]=array(
  260. 'fk_menu'=>'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  261. 'type'=>'left', // This is a Left menu entry
  262. 'titre'=>'ConferenceOrBooth',
  263. 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'),
  264. 'mainmenu'=>'project',
  265. 'leftmenu'=>'eventorganizationconforbooth',
  266. 'url'=>'',
  267. 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  268. 'position'=>1000+$r,
  269. 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  270. 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
  271. 'target'=>'',
  272. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  273. );
  274. $this->menu[$r++]=array(
  275. 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  276. 'type'=>'left', // This is a Left menu entry
  277. 'titre'=>'List',
  278. 'url'=>'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
  279. 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  280. 'position'=>1000+$r,
  281. 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  282. 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
  283. 'target'=>'',
  284. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  285. );
  286. $this->menu[$r++]=array(
  287. 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  288. 'type'=>'left', // This is a Left menu entry
  289. 'titre'=>'New',
  290. 'url'=>'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
  291. 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  292. 'position'=>1000+$r,
  293. 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  294. 'perms'=>'$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
  295. 'target'=>'',
  296. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  297. );
  298. /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */
  299. // Exports profiles provided by this module
  300. $r = 1;
  301. /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */
  302. /* END MODULEBUILDER EXPORT CONFERENCEORBOOTH */
  303. // Imports profiles provided by this module
  304. $r = 1;
  305. /* BEGIN MODULEBUILDER IMPORT CONFERENCEORBOOTH */
  306. /* END MODULEBUILDER IMPORT CONFERENCEORBOOTH */
  307. }
  308. /**
  309. * Function called when module is enabled.
  310. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  311. * It also creates data directories
  312. *
  313. * @param string $options Options when enabling module ('', 'noboxes')
  314. * @return int 1 if OK, 0 if KO
  315. */
  316. public function init($options = '')
  317. {
  318. global $conf, $langs;
  319. $result = $this->_load_tables('/eventorganization/sql/');
  320. if ($result < 0) {
  321. return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
  322. }
  323. // Permissions
  324. $this->remove($options);
  325. $sql = array();
  326. // Document templates
  327. $moduledir = 'eventorganization';
  328. $myTmpObjects = array();
  329. $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
  330. foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
  331. if ($myTmpObjectKey == 'ConferenceOrBooth') {
  332. continue;
  333. }
  334. if ($myTmpObjectArray['includerefgeneration']) {
  335. $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/eventorganization/template_conferenceorbooths.odt';
  336. $dirodt = DOL_DATA_ROOT.'/doctemplates/eventorganization';
  337. $dest = $dirodt.'/template_conferenceorbooths.odt';
  338. if (file_exists($src) && !file_exists($dest)) {
  339. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  340. dol_mkdir($dirodt);
  341. $result = dol_copy($src, $dest, 0, 0);
  342. if ($result < 0) {
  343. $langs->load("errors");
  344. $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
  345. return 0;
  346. }
  347. }
  348. $sql = array_merge($sql, array(
  349. "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
  350. "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
  351. "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
  352. "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
  353. ));
  354. }
  355. }
  356. return $this->_init($sql, $options);
  357. }
  358. /**
  359. * Function called when module is disabled.
  360. * Remove from database constants, boxes and permissions from Dolibarr database.
  361. * Data directories are not deleted
  362. *
  363. * @param string $options Options when enabling module ('', 'noboxes')
  364. * @return int 1 if OK, 0 if KO
  365. */
  366. public function remove($options = '')
  367. {
  368. $sql = array();
  369. return $this->_remove($sql, $options);
  370. }
  371. }