modAccounting.class.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <?php
  2. /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
  3. * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
  4. * Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
  5. * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
  6. * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/core/modules/modAccounting.class.php
  23. * \ingroup Advanced accountancy
  24. * \brief Module to activate Accounting Expert module
  25. */
  26. include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
  27. /**
  28. * \class modAccounting
  29. * \brief Description and activation class for module accounting expert
  30. */
  31. class modAccounting extends DolibarrModules
  32. {
  33. /**
  34. * Constructor. Define names, constants, directories, boxes, permissions
  35. *
  36. * @param DoliDB $db Database handler
  37. */
  38. function __construct($db)
  39. {
  40. global $conf;
  41. $this->db = $db;
  42. $this->numero = 50400;
  43. $this->family = "financial";
  44. $this->module_position = 610;
  45. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  46. $this->name = preg_replace('/^mod/i', '', get_class($this));
  47. $this->description = "Advanced accounting management";
  48. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  49. $this->version = 'experimental';
  50. $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
  51. $this->special = 0;
  52. $this->picto = 'accounting';
  53. // Defined if the directory /mymodule/inc/triggers/ contains triggers or not
  54. // $this->triggers = 1;
  55. // Data directories to create when module is enabled
  56. $this->dirs = array('/accounting/temp');
  57. // Config pages
  58. $this->config_page_url = array('index.php@accountancy');
  59. // Dependencies
  60. $this->depends = array("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled
  61. $this->requiredby = array(); // List of modules id to disable if this one is disabled
  62. $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
  63. $this->phpmin = array(5, 3); // Minimum version of PHP required by module
  64. $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module
  65. $this->langfiles = array("accountancy");
  66. // Constants
  67. $this->const = array();
  68. $this->const[1] = array(
  69. "MAIN_COMPANY_CODE_ALWAYS_REQUIRED",
  70. "chaine",
  71. "1",
  72. "With this constants on, third party code is always required whatever is numbering module behaviour"
  73. );
  74. $this->const[2] = array(
  75. "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED",
  76. "chaine",
  77. "1",
  78. "With this constants on, bank account number is always required"
  79. );
  80. $this->const[1] = array(
  81. "ACCOUNTING_EXPORT_SEPARATORCSV",
  82. "string",
  83. ","
  84. );
  85. $this->const[2] = array(
  86. "ACCOUNTING_ACCOUNT_SUSPENSE",
  87. "chaine",
  88. "471"
  89. );
  90. $this->const[3] = array(
  91. "ACCOUNTING_SELL_JOURNAL",
  92. "chaine",
  93. "VTE"
  94. );
  95. $this->const[4] = array(
  96. "ACCOUNTING_PURCHASE_JOURNAL",
  97. "chaine",
  98. "ACH"
  99. );
  100. $this->const[5] = array(
  101. "ACCOUNTING_SOCIAL_JOURNAL",
  102. "chaine",
  103. "SOC"
  104. );
  105. $this->const[6] = array(
  106. "ACCOUNTING_MISCELLANEOUS_JOURNAL",
  107. "chaine",
  108. "OD"
  109. );
  110. $this->const[7] = array(
  111. "ACCOUNTING_ACCOUNT_TRANSFER_CASH",
  112. "chaine",
  113. "58"
  114. );
  115. $this->const[8] = array(
  116. "CHARTOFACCOUNTS",
  117. "chaine",
  118. "2"
  119. );
  120. $this->const[9] = array(
  121. "ACCOUNTING_EXPORT_MODELCSV",
  122. "chaine",
  123. "1"
  124. );
  125. $this->const[10] = array(
  126. "ACCOUNTING_LENGTH_GACCOUNT",
  127. "chaine",
  128. ""
  129. );
  130. $this->const[11] = array(
  131. "ACCOUNTING_LENGTH_AACCOUNT",
  132. "chaine",
  133. ""
  134. );
  135. $this->const[12] = array(
  136. "ACCOUNTING_LIMIT_LIST_VENTILATION",
  137. "chaine",
  138. "50"
  139. );
  140. $this->const[13] = array(
  141. "ACCOUNTING_LIST_SORT_VENTILATION_TODO",
  142. "yesno",
  143. "1"
  144. );
  145. $this->const[14] = array(
  146. "ACCOUNTING_LIST_SORT_VENTILATION_DONE",
  147. "yesno",
  148. "1"
  149. );
  150. /*
  151. $this->const[15] = array (
  152. "ACCOUNTING_GROUPBYACCOUNT",
  153. "yesno",
  154. "1"
  155. );
  156. */
  157. $this->const[16] = array (
  158. "ACCOUNTING_EXPORT_DATE",
  159. "chaine",
  160. "%d%m%Y"
  161. );
  162. /*
  163. $this->const[17] = array (
  164. "ACCOUNTING_EXPORT_PIECE",
  165. "yesno",
  166. "1"
  167. );
  168. $this->const[18] = array (
  169. "ACCOUNTING_EXPORT_GLOBAL_ACCOUNT",
  170. "yesno",
  171. "1"
  172. );
  173. $this->const[19] = array (
  174. "ACCOUNTING_EXPORT_LABEL",
  175. "yesno",
  176. "1"
  177. );
  178. $this->const[20] = array (
  179. "ACCOUNTING_EXPORT_AMOUNT",
  180. "yesno",
  181. "1"
  182. );
  183. $this->const[21] = array (
  184. "ACCOUNTING_EXPORT_DEVISE",
  185. "yesno",
  186. "1"
  187. );
  188. */
  189. $this->const[22] = array(
  190. "ACCOUNTING_EXPENSEREPORT_JOURNAL",
  191. "chaine",
  192. "ER"
  193. );
  194. $this->const[23] = array(
  195. "ACCOUNTING_EXPORT_FORMAT",
  196. "chaine",
  197. "csv"
  198. );
  199. // Tabs
  200. $this->tabs = array();
  201. // Css
  202. $this->module_parts = array();
  203. // Boxes
  204. $this->boxes = array();
  205. // Permissions
  206. $this->rights_class = 'accounting';
  207. $this->rights = array(); // Permission array used by this module
  208. $r = 0;
  209. $this->rights[$r][0] = 50401;
  210. $this->rights[$r][1] = 'Read ventilation';
  211. $this->rights[$r][2] = 'r';
  212. $this->rights[$r][3] = 0;
  213. $this->rights[$r][4] = 'ventilation';
  214. $this->rights[$r][5] = 'read';
  215. $r++;
  216. $this->rights[$r][0] = 50402;
  217. $this->rights[$r][1] = 'Dispatched ventilation';
  218. $this->rights[$r][2] = 'r';
  219. $this->rights[$r][3] = 0;
  220. $this->rights[$r][4] = 'ventilation';
  221. $this->rights[$r][5] = 'dispatch';
  222. $r++;
  223. $this->rights[$r][0] = 50411;
  224. $this->rights[$r][1] = 'Lire les mouvements comptables';
  225. $this->rights[$r][2] = 'r';
  226. $this->rights[$r][3] = 0;
  227. $this->rights[$r][4] = 'mouvements';
  228. $this->rights[$r][5] = 'lire';
  229. $r++;
  230. $this->rights[$r][0] = 50412;
  231. $this->rights[$r][1] = 'Creer/modifier/annuler les mouvements comptables';
  232. $this->rights[$r][2] = 'w';
  233. $this->rights[$r][3] = 0;
  234. $this->rights[$r][4] = 'mouvements';
  235. $this->rights[$r][5] = 'creer';
  236. $r++;
  237. $this->rights[$r][0] = 50420;
  238. $this->rights[$r][1] = 'Lire CA, bilans, resultats, journaux, grands livres';
  239. $this->rights[$r][2] = 'r';
  240. $this->rights[$r][3] = 0;
  241. $this->rights[$r][4] = 'comptarapport';
  242. $this->rights[$r][5] = 'lire';
  243. $r++;
  244. $this->rights[$r][0] = 50430;
  245. $this->rights[$r][1] = 'Define and close a fiscal year';
  246. $this->rights[$r][2] = 'r';
  247. $this->rights[$r][3] = 0;
  248. $this->rights[$r][4] = 'fiscalyear';
  249. $this->rights[$r][5] = '';
  250. $r++;
  251. $this->rights[$r][0] = 50440;
  252. $this->rights[$r][1] = 'Manage chart of accounts';
  253. $this->rights[$r][2] = 'r';
  254. $this->rights[$r][3] = 0;
  255. $this->rights[$r][4] = 'chartofaccount';
  256. $this->rights[$r][5] = '';
  257. $r++;
  258. // Main menu entries
  259. $this->menus = array();
  260. $r = 0;
  261. }
  262. }