modPaymentByBankTransfer.class.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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@inodbox.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 <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \defgroup paymentbybanktransfer Module paymentbybanktransfer
  22. * \brief Module to manage payment by bank transfer
  23. * \file htdocs/core/modules/modPaymentByBankTransfer.class.php
  24. * \ingroup paymentbybanktransfer
  25. * \brief Description and activation file for the module PaymentByBankTransfer
  26. */
  27. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  28. /**
  29. * Class to describe and enable module of payment by Bank transfer
  30. */
  31. class modPaymentByBankTransfer 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 = 56;
  43. $this->family = "financial";
  44. $this->module_position = '52';
  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 = "Management of payment by bank transfer";
  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. // 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("/paymentbybanktransfer/temp", "/paymentbybanktransfer/receipts");
  55. // Dependencies
  56. $this->hidden = false; // A condition to hide module
  57. $this->depends = array("modFournisseur", "modBanque"); // List of module class names as string that must be enabled if this module is enabled
  58. $this->requiredby = array(); // List of module ids to disable if this one is disabled
  59. $this->conflictwith = array(); // List of module class names as string this module is in conflict with
  60. $this->phpmin = array(5, 6); // Minimum version of PHP required by module
  61. // Config pages
  62. $this->config_page_url = array("paymentbybanktransfer.php");
  63. // Constants
  64. $this->const = array();
  65. $r = 0;
  66. /*$this->const[$r][0] = "BANK_ADDON_PDF";
  67. $this->const[$r][1] = "chaine";
  68. $this->const[$r][2] = "sepamandate";
  69. $this->const[$r][3] = 'Name of manager to generate SEPA mandate';
  70. $this->const[$r][4] = 0;
  71. $r++;*/
  72. // Boxes
  73. $this->boxes = array();
  74. // Permissions
  75. $this->rights = array();
  76. $this->rights_class = 'paymentbybanktransfer';
  77. $r = 0;
  78. $r++;
  79. $this->rights[$r][0] = 561;
  80. $this->rights[$r][1] = 'Read bank transfer payment orders';
  81. $this->rights[$r][2] = 'r';
  82. $this->rights[$r][3] = 0;
  83. $this->rights[$r][4] = 'read';
  84. $r++;
  85. $this->rights[$r][0] = 562;
  86. $this->rights[$r][1] = 'Create/modify a bank transfer payment order';
  87. $this->rights[$r][2] = 'w';
  88. $this->rights[$r][3] = 0;
  89. $this->rights[$r][4] = 'create';
  90. $r++;
  91. $this->rights[$r][0] = 563;
  92. $this->rights[$r][1] = 'Send/Transmit bank transfer payment order';
  93. $this->rights[$r][2] = 'a';
  94. $this->rights[$r][3] = 0;
  95. $this->rights[$r][4] = 'send';
  96. $r++;
  97. $this->rights[$r][0] = 564;
  98. $this->rights[$r][1] = 'Record Debits/Rejects of bank transfer payment order';
  99. $this->rights[$r][2] = 'a';
  100. $this->rights[$r][3] = 0;
  101. $this->rights[$r][4] = 'debit';
  102. // Menus
  103. //-------
  104. $this->menu = 1; // This module add menu entries. They are coded into menu manager.
  105. }
  106. /**
  107. * Function called when module is enabled.
  108. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  109. * It also creates data directories
  110. *
  111. * @param string $options Options when enabling module ('', 'noboxes')
  112. * @return int 1 if OK, 0 if KO
  113. */
  114. public function init($options = '')
  115. {
  116. global $conf;
  117. // Permissions
  118. $this->remove($options);
  119. $sql = array();
  120. return $this->_init($sql, $options);
  121. }
  122. }