modPrelevement.class.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
  5. * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
  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 <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \defgroup prelevement Module prelevement
  22. * \brief Module de gestion des prelevements bancaires
  23. * \file htdocs/core/modules/modPrelevement.class.php
  24. * \ingroup prelevement
  25. * \brief Fichier de description et activation du module Prelevement
  26. */
  27. include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
  28. /**
  29. * Classe de description et activation du module Prelevement
  30. */
  31. class modPrelevement 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 = 57;
  43. $this->family = "financial";
  44. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  45. $this->name = preg_replace('/^mod/i','',get_class($this));
  46. $this->description = "Gestion des Prelevements";
  47. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  48. $this->version = 'dolibarr';
  49. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  50. $this->special = 0;
  51. // Name of png file (without png) used for this module
  52. $this->picto='payment';
  53. // Data directories to create when module is enabled
  54. $this->dirs = array("/prelevement/temp","/prelevement/receipts");
  55. // Dependancies
  56. $this->depends = array("modFacture","modBanque");
  57. $this->requiredby = array();
  58. // Config pages
  59. $this->config_page_url = array("prelevement.php");
  60. // Constantes
  61. $this->const = array();
  62. // Boites
  63. $this->boxes = array();
  64. // Permissions
  65. $this->rights = array();
  66. $this->rights_class = 'prelevement';
  67. $r=0;
  68. $r++;
  69. $this->rights[$r][0] = 151;
  70. $this->rights[$r][1] = 'Read withdrawals';
  71. $this->rights[$r][2] = 'r';
  72. $this->rights[$r][3] = 1;
  73. $this->rights[$r][4] = 'bons';
  74. $this->rights[$r][5] = 'lire';
  75. $r++;
  76. $this->rights[$r][0] = 152;
  77. $this->rights[$r][1] = 'Create/modify a withdrawals';
  78. $this->rights[$r][2] = 'w';
  79. $this->rights[$r][3] = 0;
  80. $this->rights[$r][4] = 'bons';
  81. $this->rights[$r][5] = 'creer';
  82. $r++;
  83. $this->rights[$r][0] = 153;
  84. $this->rights[$r][1] = 'Send withdrawals to bank';
  85. $this->rights[$r][2] = 'a';
  86. $this->rights[$r][3] = 0;
  87. $this->rights[$r][4] = 'bons';
  88. $this->rights[$r][5] = 'send';
  89. $r++;
  90. $this->rights[$r][0] = 154;
  91. $this->rights[$r][1] = 'credit/refuse withdrawals';
  92. $this->rights[$r][2] = 'a';
  93. $this->rights[$r][3] = 0;
  94. $this->rights[$r][4] = 'bons';
  95. $this->rights[$r][5] = 'credit';
  96. /* $this->rights[2][0] = 154;
  97. $this->rights[2][1] = 'Setup withdraw account';
  98. $this->rights[2][2] = 'w';
  99. $this->rights[2][3] = 0;
  100. $this->rights[2][4] = 'bons';
  101. $this->rights[2][5] = 'configurer';
  102. */
  103. }
  104. /**
  105. * Function called when module is enabled.
  106. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  107. * It also creates data directories
  108. *
  109. * @param string $options Options when enabling module ('', 'noboxes')
  110. * @return int 1 if OK, 0 if KO
  111. */
  112. function init($options='')
  113. {
  114. global $conf;
  115. // Permissions
  116. $this->remove($options);
  117. $sql = array();
  118. return $this->_init($sql,$options);
  119. }
  120. /**
  121. * Function called when module is disabled.
  122. * Remove from database constants, boxes and permissions from Dolibarr database.
  123. * Data directories are not deleted
  124. *
  125. * @param string $options Options when enabling module ('', 'noboxes')
  126. * @return int 1 if OK, 0 if KO
  127. */
  128. function remove($options='')
  129. {
  130. $sql = array();
  131. return $this->_remove($sql,$options);
  132. }
  133. }