modComptabilite.class.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
  5. * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \defgroup comptabilite Module comptabilite
  22. * \brief Module pour inclure des fonctions de comptabilite (gestion de comptes comptables et rapports)
  23. * \file htdocs/core/modules/modComptabilite.class.php
  24. * \ingroup comptabilite
  25. * \brief Description and activation file for the module simple accountancy
  26. */
  27. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  28. /**
  29. * Class to describe and enable module Comptabilite
  30. */
  31. class modComptabilite 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 $conf;
  41. $this->db = $db;
  42. $this->numero = 10;
  43. $this->family = "financial";
  44. $this->module_position = '60';
  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 = "Gestion sommaire de comptabilite";
  48. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  49. $this->version = 'dolibarr';
  50. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  51. $this->picto = 'accountancy';
  52. // Config pages
  53. $this->config_page_url = array("compta.php");
  54. // Dependencies
  55. $this->depends = array("modFacture", "modBanque");
  56. $this->requiredby = array();
  57. $this->conflictwith = array("modAccounting");
  58. $this->langfiles = array("compta");
  59. // Constants
  60. $this->const = array();
  61. // Data directories to create when module is enabled
  62. $this->dirs = array(
  63. "/comptabilite/temp",
  64. "/comptabilite/rapport",
  65. "/comptabilite/export",
  66. "/comptabilite/bordereau"
  67. );
  68. // Boxes
  69. $this->boxes = array();
  70. // Permissions
  71. $this->rights = array();
  72. $this->rights_class = 'compta';
  73. $r = 0;
  74. $r++;
  75. $this->rights[$r][0] = 95;
  76. $this->rights[$r][1] = 'Lire CA, bilans, resultats';
  77. $this->rights[$r][2] = 'r';
  78. $this->rights[$r][3] = 0;
  79. $this->rights[$r][4] = 'resultat';
  80. $this->rights[$r][5] = 'lire';
  81. // Menus
  82. //-------
  83. $this->menu = 1; // This module add menu entries. They are coded into menu manager.
  84. }
  85. /**
  86. * Function called when module is enabled.
  87. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  88. * It also creates data directories
  89. *
  90. * @param string $options Options when enabling module ('', 'noboxes')
  91. * @return int 1 if OK, 0 if KO
  92. */
  93. public function init($options = '')
  94. {
  95. global $conf;
  96. // Nettoyage avant activation
  97. $this->remove($options);
  98. $sql = array();
  99. return $this->_init($sql, $options);
  100. }
  101. }