No Description

modPhotocopies.class.php 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <?php
  2. /* <one line to give the program's name and a brief idea of what it does.>
  3. * dolibarr_photocopies - Plugin for photocopies buisiness management
  4. * Copyright (C) 2013 Ghislain Loaec
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \defgroup photocopies Photocopies module
  21. * \brief Photocopies module descriptor.
  22. * \file core/modules/modPhotocopies.class.php
  23. * \ingroup photocopies
  24. * \brief Description and activation file for module Photocopies
  25. */
  26. include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
  27. /**
  28. * Description and activation class for module MyModule
  29. */
  30. class modPhotocopies extends DolibarrModules
  31. {
  32. /**
  33. * Constructor. Define names, constants, directories, boxes, permissions
  34. *
  35. * @param DoliDB $db Database handler
  36. */
  37. public function __construct($db)
  38. {
  39. global $langs, $conf;
  40. $this->db = $db;
  41. // Id for module (must be unique).
  42. // Use a free id here
  43. // (See in Home -> System information -> Dolibarr for list of used modules id).
  44. $this->numero = 6182;
  45. // Key text used to identify module (for permissions, menus, etc...)
  46. $this->rights_class = 'photocopies';
  47. // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
  48. // It is used to group modules in module setup page
  49. $this->family = "other";
  50. // Module label (no space allowed)
  51. // used if translation string 'ModuleXXXName' not found
  52. // (where XXX is value of numeric property 'numero' of module)
  53. $this->name = preg_replace('/^mod/i', '', get_class($this));
  54. // Module description
  55. // used if translation string 'ModuleXXXDesc' not found
  56. // (where XXX is value of numeric property 'numero' of module)
  57. $this->description = "Description of module Photocopies";
  58. // Possible values for version are: 'development', 'experimental' or version
  59. $this->version = 'development';
  60. // Key used in llx_const table to save module status enabled/disabled
  61. // (where MYMODULE is value of property name of module in uppercase)
  62. $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
  63. // Where to store the module in setup page
  64. // (0=common,1=interface,2=others,3=very specific)
  65. $this->special = 3;
  66. // Name of image file used for this module.
  67. // If file is in theme/yourtheme/img directory under name object_pictovalue.png
  68. // use this->picto='pictovalue'
  69. // If file is in module/img directory under name object_pictovalue.png
  70. // use this->picto='pictovalue@module'
  71. $this->picto = 'photocopies@photocopies'; // mypicto@photocopies
  72. // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
  73. // for default path (eg: /photocopies/core/xxxxx) (0=disable, 1=enable)
  74. // for specific path of parts (eg: /photocopies/core/modules/barcode)
  75. // for specific css file (eg: /photocopies/css/photocopies.css.php)
  76. $this->module_parts = array(
  77. // Set this to 1 if module has its own trigger directory
  78. 'triggers' => 1,
  79. // Set this to 1 if module has its own login method directory
  80. //'login' => 0,
  81. // Set this to 1 if module has its own substitution function file
  82. //'substitutions' => 0,
  83. // Set this to 1 if module has its own menus handler directory
  84. //'menus' => 0,
  85. // Set this to 1 if module has its own barcode directory
  86. //'barcode' => 0,
  87. // Set this to 1 if module has its own models directory
  88. //'models' => 0,
  89. // Set this to relative path of css if module has its own css file
  90. 'css' => '/photocopies/css/mycss.css.php',
  91. // Set here all hooks context managed by module
  92. //'hooks' => array('hookcontext1','hookcontext2')
  93. // Set here all workflow context managed by module
  94. //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
  95. );
  96. // Data directories to create when module is enabled.
  97. // Example: this->dirs = array("/photocopies/temp");
  98. $this->dirs = array();
  99. // Config pages. Put here list of php pages
  100. // stored into photocopies/admin directory, used to setup module.
  101. $this->config_page_url = array("admin_photocopies.php@photocopies");
  102. // Dependencies
  103. // List of modules id that must be enabled if this module is enabled
  104. $this->depends = array();
  105. // List of modules id to disable if this one is disabled
  106. $this->requiredby = array();
  107. // Minimum version of PHP required by module
  108. $this->phpmin = array(5, 3);
  109. // Minimum version of Dolibarr required by module
  110. $this->need_dolibarr_version = array(3, 2);
  111. $this->langfiles = array("photocopies@photocopies"); // langfiles@photocopies
  112. // Constants
  113. // List of particular constants to add when module is enabled
  114. // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
  115. // Example:
  116. $this->const = array(
  117. // 0=>array(
  118. // 'MYMODULE_MYNEWCONST1',
  119. // 'chaine',
  120. // 'myvalue',
  121. // 'This is a constant to add',
  122. // 1
  123. // ),
  124. // 1=>array(
  125. // 'MYMODULE_MYNEWCONST2',
  126. // 'chaine',
  127. // 'myvalue',
  128. // 'This is another constant to add',
  129. // 0
  130. // )
  131. );
  132. // Array to add new pages in new tabs
  133. // Example:
  134. $this->tabs = array(
  135. // // To add a new tab identified by code tabname1
  136. // 'objecttype:+tabname1:Title1:langfile@photocopies:$user->rights->photocopies->read:/photocopies/mynewtab1.php?id=__ID__',
  137. // // To add another new tab identified by code tabname2
  138. // 'objecttype:+tabname2:Title2:langfile@photocopies:$user->rights->othermodule->read:/photocopies/mynewtab2.php?id=__ID__',
  139. // // To remove an existing tab identified by code tabname
  140. // 'objecttype:-tabname'
  141. );
  142. // where objecttype can be
  143. // 'thirdparty' to add a tab in third party view
  144. // 'intervention' to add a tab in intervention view
  145. // 'order_supplier' to add a tab in supplier order view
  146. // 'invoice_supplier' to add a tab in supplier invoice view
  147. // 'invoice' to add a tab in customer invoice view
  148. // 'order' to add a tab in customer order view
  149. // 'product' to add a tab in product view
  150. // 'stock' to add a tab in stock view
  151. // 'propal' to add a tab in propal view
  152. // 'member' to add a tab in fundation member view
  153. // 'contract' to add a tab in contract view
  154. // 'user' to add a tab in user view
  155. // 'group' to add a tab in group view
  156. // 'contact' to add a tab in contact view
  157. // 'categories_x' to add a tab in category view
  158. // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
  159. // Dictionnaries
  160. if (! isset($conf->photocopies->enabled)) {
  161. $conf->photocopies=new stdClass();
  162. $conf->photocopies->enabled = 0;
  163. }
  164. $this->dictionnaries = array();
  165. /* Example:
  166. // This is to avoid warnings
  167. if (! isset($conf->photocopies->enabled)) $conf->photocopies->enabled=0;
  168. $this->dictionnaries=array(
  169. 'langs'=>'photocopies@photocopies',
  170. // List of tables we want to see into dictonnary editor
  171. 'tabname'=>array(
  172. MAIN_DB_PREFIX."table1",
  173. MAIN_DB_PREFIX."table2",
  174. MAIN_DB_PREFIX."table3"
  175. ),
  176. // Label of tables
  177. 'tablib'=>array("Table1","Table2","Table3"),
  178. // Request to select fields
  179. 'tabsql'=>array(
  180. 'SELECT f.rowid as rowid, f.code, f.label, f.active'
  181. . ' FROM ' . MAIN_DB_PREFIX . 'table1 as f',
  182. 'SELECT f.rowid as rowid, f.code, f.label, f.active'
  183. . ' FROM ' . MAIN_DB_PREFIX . 'table2 as f',
  184. 'SELECT f.rowid as rowid, f.code, f.label, f.active'
  185. . ' FROM ' . MAIN_DB_PREFIX . 'table3 as f'
  186. ),
  187. // Sort order
  188. 'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
  189. // List of fields (result of select to show dictionnary)
  190. 'tabfield'=>array("code,label","code,label","code,label"),
  191. // List of fields (list of fields to edit a record)
  192. 'tabfieldvalue'=>array("code,label","code,label","code,label"),
  193. // List of fields (list of fields for insert)
  194. 'tabfieldinsert'=>array("code,label","code,label","code,label"),
  195. // Name of columns with primary key (try to always name it 'rowid')
  196. 'tabrowid'=>array("rowid","rowid","rowid"),
  197. // Condition to show each dictionnary
  198. 'tabcond'=>array(
  199. $conf->photocopies->enabled,
  200. $conf->photocopies->enabled,
  201. $conf->photocopies->enabled
  202. )
  203. );
  204. */
  205. // Boxes
  206. // Add here list of php file(s) stored in core/boxes that contains class to show a box.
  207. $this->boxes = array(); // Boxes list
  208. $r = 0;
  209. // Example:
  210. $this->boxes[$r][1] = "MyBox@photocopies";
  211. $r ++;
  212. /*
  213. $this->boxes[$r][1] = "myboxb.php";
  214. $r++;
  215. */
  216. // Permissions
  217. $this->rights = array(); // Permission array used by this module
  218. $r = 0;
  219. // Add here list of permission defined by
  220. // an id, a label, a boolean and two constant strings.
  221. // Example:
  222. //// Permission id (must not be already used)
  223. //$this->rights[$r][0] = 2000;
  224. //// Permission label
  225. //$this->rights[$r][1] = 'Permision label';
  226. //// Permission by default for new user (0/1)
  227. //$this->rights[$r][3] = 1;
  228. //// In php code, permission will be checked by test
  229. //// if ($user->rights->permkey->level1->level2)
  230. //$this->rights[$r][4] = 'level1';
  231. //// In php code, permission will be checked by test
  232. //// if ($user->rights->permkey->level1->level2)
  233. //$this->rights[$r][5] = 'level2';
  234. //$r++;
  235. // Main menu entries
  236. $this->menus = array(); // List of menus to add
  237. $r = 0;
  238. // Add here entries to declare new menus
  239. //
  240. // Example to declare a new Top Menu entry and its Left menu entry:
  241. $this->menu[$r]=array(
  242. // Put 0 if this is a top menu
  243. 'fk_menu'=>0,
  244. // This is a Top menu entry
  245. 'type'=>'top',
  246. 'titre'=>'Photocopies',
  247. 'mainmenu'=>'photocopies',
  248. 'leftmenu'=>'photocopieurs',
  249. 'url'=>'/photocopies/index.php',
  250. // Lang file to use (without .lang) by module.
  251. // File must be in langs/code_CODE/ directory.
  252. 'langs'=>'photocopies',
  253. 'position'=>100,
  254. // Define condition to show or hide menu entry.
  255. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  256. 'enabled'=>'$conf->photocopies->enabled',
  257. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  258. // if you want your menu with a permission rules
  259. 'perms'=>'1',
  260. 'target'=>'',
  261. // 0=Menu for internal users, 1=external users, 2=both
  262. 'user'=>2
  263. );
  264. $r++;
  265. $this->menu[$r]=array(
  266. // Use r=value where r is index key used for the parent menu entry
  267. // (higher parent must be a top menu entry)
  268. 'fk_menu'=>'r=0',
  269. // This is a Left menu entry
  270. 'type'=>'left',
  271. 'titre'=>'Photocopieurs',
  272. 'mainmenu'=>'photocopies',
  273. 'leftmenu'=>'photocopieurs',
  274. 'url'=>'/photocopies/phcp.php?action=list',
  275. // Lang file to use (without .lang) by module.
  276. // File must be in langs/code_CODE/ directory.
  277. 'langs'=>'photocopies',
  278. 'position'=>100,
  279. // Define condition to show or hide menu entry.
  280. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  281. 'enabled'=>'$conf->photocopies->enabled',
  282. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  283. // if you want your menu with a permission rules
  284. 'perms'=>'1',
  285. 'target'=>'',
  286. // 0=Menu for internal users, 1=external users, 2=both
  287. 'user'=>2
  288. );
  289. $r++;
  290. //
  291. // Example to declare a Left Menu entry into an existing Top menu entry:
  292. $this->menu[$r]=array(
  293. // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
  294. 'fk_menu'=>'fk_mainmenu=photocopies,fk_leftmenu=photocopieurs',
  295. // This is a Left menu entry
  296. 'type'=>'left',
  297. 'titre'=>'New Photocopieur',
  298. 'mainmenu'=>'photocopies',
  299. 'leftmenu'=>'new_phcp',
  300. 'url'=>'/photocopies/phcp.php?action=new',
  301. // Lang file to use (without .lang) by module.
  302. // File must be in langs/code_CODE/ directory.
  303. 'langs'=>'photocopies',
  304. 'position'=>100,
  305. // Define condition to show or hide menu entry.
  306. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  307. // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  308. 'enabled'=>'$conf->photocopies->enabled',
  309. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  310. // if you want your menu with a permission rules
  311. 'perms'=>'1',
  312. 'target'=>'',
  313. // 0=Menu for internal users, 1=external users, 2=both
  314. 'user'=>2
  315. );
  316. $r++;
  317. $this->menu[$r]=array(
  318. // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
  319. 'fk_menu'=>'fk_mainmenu=photocopies,fk_leftmenu=photocopieurs',
  320. // This is a Left menu entry
  321. 'type'=>'left',
  322. 'titre'=>'List',
  323. 'mainmenu'=>'photocopies',
  324. 'leftmenu'=>'list_phcp',
  325. 'url'=>'/photocopies/phcp.php?action=list',
  326. // Lang file to use (without .lang) by module.
  327. // File must be in langs/code_CODE/ directory.
  328. 'langs'=>'photocopies',
  329. 'position'=>100,
  330. // Define condition to show or hide menu entry.
  331. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  332. // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  333. 'enabled'=>'$conf->photocopies->enabled',
  334. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  335. // if you want your menu with a permission rules
  336. 'perms'=>'1',
  337. 'target'=>'',
  338. // 0=Menu for internal users, 1=external users, 2=both
  339. 'user'=>2
  340. );
  341. $r++;
  342. $this->menu[$r]=array(
  343. // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
  344. 'fk_menu'=>'r=0',
  345. // This is a Left menu entry
  346. 'type'=>'left',
  347. 'titre'=>'Photocopieur Types',
  348. 'mainmenu'=>'photocopies',
  349. 'leftmenu'=>'photocopieur_types',
  350. 'url'=>'/photocopies/list_phcp_types.php',
  351. // Lang file to use (without .lang) by module.
  352. // File must be in langs/code_CODE/ directory.
  353. 'langs'=>'photocopies',
  354. 'position'=>100,
  355. // Define condition to show or hide menu entry.
  356. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  357. // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  358. 'enabled'=>'$conf->photocopies->enabled',
  359. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  360. // if you want your menu with a permission rules
  361. 'perms'=>'1',
  362. 'target'=>'',
  363. // 0=Menu for internal users, 1=external users, 2=both
  364. 'user'=>2
  365. );
  366. $r++;
  367. $this->menu[$r]=array(
  368. // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
  369. 'fk_menu'=>'fk_mainmenu=photocopies,fk_leftmenu=photocopieur_types',
  370. // This is a Left menu entry
  371. 'type'=>'left',
  372. 'titre'=>'New Photocopieur Type',
  373. 'mainmenu'=>'photocopies',
  374. 'leftmenu'=>'new_phcp_type',
  375. 'url'=>'/photocopies/new_phcp_type.php',
  376. // Lang file to use (without .lang) by module.
  377. // File must be in langs/code_CODE/ directory.
  378. 'langs'=>'photocopies',
  379. 'position'=>100,
  380. // Define condition to show or hide menu entry.
  381. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  382. // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  383. 'enabled'=>'$conf->photocopies->enabled',
  384. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  385. // if you want your menu with a permission rules
  386. 'perms'=>'1',
  387. 'target'=>'',
  388. // 0=Menu for internal users, 1=external users, 2=both
  389. 'user'=>2
  390. );
  391. $r++;
  392. $this->menu[$r]=array(
  393. // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
  394. 'fk_menu'=>'fk_mainmenu=photocopies,fk_leftmenu=photocopieur_types',
  395. // This is a Left menu entry
  396. 'type'=>'left',
  397. 'titre'=>'List',
  398. 'mainmenu'=>'photocopies',
  399. 'leftmenu'=>'list_phcp_type',
  400. 'url'=>'/photocopies/list_phcp_type.php',
  401. // Lang file to use (without .lang) by module.
  402. // File must be in langs/code_CODE/ directory.
  403. 'langs'=>'photocopies',
  404. 'position'=>100,
  405. // Define condition to show or hide menu entry.
  406. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  407. // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  408. 'enabled'=>'$conf->photocopies->enabled',
  409. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  410. // if you want your menu with a permission rules
  411. 'perms'=>'1',
  412. 'target'=>'',
  413. // 0=Menu for internal users, 1=external users, 2=both
  414. 'user'=>2
  415. );
  416. $r++;
  417. $this->menu[$r]=array(
  418. // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
  419. 'fk_menu'=>'r=0',
  420. // This is a Left menu entry
  421. 'type'=>'left',
  422. 'titre'=>'Compteurs',
  423. 'mainmenu'=>'photocopies',
  424. 'leftmenu'=>'compteurs',
  425. 'url'=>'/photocopies/compteurs.php',
  426. // Lang file to use (without .lang) by module.
  427. // File must be in langs/code_CODE/ directory.
  428. 'langs'=>'photocopies',
  429. 'position'=>100,
  430. // Define condition to show or hide menu entry.
  431. // Use '$conf->photocopies->enabled' if entry must be visible if module is enabled.
  432. // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  433. 'enabled'=>'$conf->photocopies->enabled',
  434. // Use 'perms'=>'$user->rights->photocopies->level1->level2'
  435. // if you want your menu with a permission rules
  436. 'perms'=>'1',
  437. 'target'=>'',
  438. // 0=Menu for internal users, 1=external users, 2=both
  439. 'user'=>2
  440. );
  441. $r++;
  442. // Exports
  443. $r = 1;
  444. // Example:
  445. //$this->export_code[$r]=$this->rights_class.'_'.$r;
  446. //// Translation key (used only if key ExportDataset_xxx_z not found)
  447. //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
  448. //// Condition to show export in list (ie: '$user->id==3').
  449. //// Set to 1 to always show when module is enabled.
  450. //$this->export_enabled[$r]='1';
  451. //$this->export_permission[$r]=array(array("facture","facture","export"));
  452. //$this->export_fields_array[$r]=array(
  453. // 's.rowid'=>"IdCompany",
  454. // 's.nom'=>'CompanyName',
  455. // 's.address'=>'Address',
  456. // 's.cp'=>'Zip',
  457. // 's.ville'=>'Town',
  458. // 's.fk_pays'=>'Country',
  459. // 's.tel'=>'Phone',
  460. // 's.siren'=>'ProfId1',
  461. // 's.siret'=>'ProfId2',
  462. // 's.ape'=>'ProfId3',
  463. // 's.idprof4'=>'ProfId4',
  464. // 's.code_compta'=>'CustomerAccountancyCode',
  465. // 's.code_compta_fournisseur'=>'SupplierAccountancyCode',
  466. // 'f.rowid'=>"InvoiceId",
  467. // 'f.facnumber'=>"InvoiceRef",
  468. // 'f.datec'=>"InvoiceDateCreation",
  469. // 'f.datef'=>"DateInvoice",
  470. // 'f.total'=>"TotalHT",
  471. // 'f.total_ttc'=>"TotalTTC",
  472. // 'f.tva'=>"TotalVAT",
  473. // 'f.paye'=>"InvoicePaid",
  474. // 'f.fk_statut'=>'InvoiceStatus',
  475. // 'f.note'=>"InvoiceNote",
  476. // 'fd.rowid'=>'LineId',
  477. // 'fd.description'=>"LineDescription",
  478. // 'fd.price'=>"LineUnitPrice",
  479. // 'fd.tva_tx'=>"LineVATRate",
  480. // 'fd.qty'=>"LineQty",
  481. // 'fd.total_ht'=>"LineTotalHT",
  482. // 'fd.total_tva'=>"LineTotalTVA",
  483. // 'fd.total_ttc'=>"LineTotalTTC",
  484. // 'fd.date_start'=>"DateStart",
  485. // 'fd.date_end'=>"DateEnd",
  486. // 'fd.fk_product'=>'ProductId',
  487. // 'p.ref'=>'ProductRef'
  488. //);
  489. //$this->export_entities_array[$r]=array('s.rowid'=>"company",
  490. // 's.nom'=>'company',
  491. // 's.address'=>'company',
  492. // 's.cp'=>'company',
  493. // 's.ville'=>'company',
  494. // 's.fk_pays'=>'company',
  495. // 's.tel'=>'company',
  496. // 's.siren'=>'company',
  497. // 's.siret'=>'company',
  498. // 's.ape'=>'company',
  499. // 's.idprof4'=>'company',
  500. // 's.code_compta'=>'company',
  501. // 's.code_compta_fournisseur'=>'company',
  502. // 'f.rowid'=>"invoice",
  503. // 'f.facnumber'=>"invoice",
  504. // 'f.datec'=>"invoice",
  505. // 'f.datef'=>"invoice",
  506. // 'f.total'=>"invoice",
  507. // 'f.total_ttc'=>"invoice",
  508. // 'f.tva'=>"invoice",
  509. // 'f.paye'=>"invoice",
  510. // 'f.fk_statut'=>'invoice',
  511. // 'f.note'=>"invoice",
  512. // 'fd.rowid'=>'invoice_line',
  513. // 'fd.description'=>"invoice_line",
  514. // 'fd.price'=>"invoice_line",
  515. // 'fd.total_ht'=>"invoice_line",
  516. // 'fd.total_tva'=>"invoice_line",
  517. // 'fd.total_ttc'=>"invoice_line",
  518. // 'fd.tva_tx'=>"invoice_line",
  519. // 'fd.qty'=>"invoice_line",
  520. // 'fd.date_start'=>"invoice_line",
  521. // 'fd.date_end'=>"invoice_line",
  522. // 'fd.fk_product'=>'product',
  523. // 'p.ref'=>'product'
  524. //);
  525. //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
  526. //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
  527. // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
  528. //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
  529. // . 'product as p on (fd.fk_product = p.rowid)';
  530. //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
  531. // . 'AND f.rowid = fd.fk_facture';
  532. //$r++;
  533. }
  534. /**
  535. * Function called when module is enabled.
  536. * The init function add constants, boxes, permissions and menus
  537. * (defined in constructor) into Dolibarr database.
  538. * It also creates data directories
  539. *
  540. * @param string $options Options when enabling module ('', 'noboxes')
  541. * @return int 1 if OK, 0 if KO
  542. */
  543. public function init($options = '')
  544. {
  545. $sql = array();
  546. $result = $this->loadTables();
  547. return $this->_init($sql, $options);
  548. }
  549. /**
  550. * Function called when module is disabled.
  551. * Remove from database constants, boxes and permissions from Dolibarr database.
  552. * Data directories are not deleted
  553. *
  554. * @param string $options Options when enabling module ('', 'noboxes')
  555. * @return int 1 if OK, 0 if KO
  556. */
  557. public function remove($options = '')
  558. {
  559. $sql = array();
  560. return $this->_remove($sql, $options);
  561. }
  562. /**
  563. * Create tables, keys and data required by module
  564. * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
  565. * and create data commands must be stored in directory /photocopies/sql/
  566. * This function is called by this->init
  567. *
  568. * @return int <=0 if KO, >0 if OK
  569. */
  570. private function loadTables()
  571. {
  572. return $this->_load_tables('/photocopies/sql/');
  573. }
  574. }