dolibarr 20.0.2
modPrelevement.class.php
Go to the documentation of this file.
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
29include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30
31
36{
42 public function __construct($db)
43 {
44 global $conf;
45
46 $this->db = $db;
47 $this->numero = 57;
48
49 $this->family = "financial";
50 $this->module_position = '52';
51 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
52 $this->name = preg_replace('/^mod/i', '', get_class($this));
53 $this->description = "Management of Direct Debit orders";
54
55 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
56 $this->version = 'dolibarr';
57
58 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
59 // Name of png file (without png) used for this module
60 $this->picto = 'payment';
61
62 // Data directories to create when module is enabled
63 $this->dirs = array("/prelevement/temp", "/prelevement/receipts");
64
65 // Dependencies
66 $this->hidden = false; // A condition to hide module
67 $this->depends = array("modFacture", "modBanque"); // List of module class names as string that must be enabled if this module is enabled
68 $this->requiredby = array(); // List of module ids to disable if this one is disabled
69 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
70 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
71
72 // Config pages
73 $this->config_page_url = array("prelevement.php");
74
75 // Constants
76 $this->const = array();
77 $r = 0;
78
79 $this->const[$r][0] = "BANK_ADDON_PDF";
80 $this->const[$r][1] = "chaine";
81 $this->const[$r][2] = "sepamandate";
82 $this->const[$r][3] = 'Name of manager to generate SEPA mandate';
83 $this->const[$r][4] = 0;
84 $r++;
85
86
87 // Boxes
88 $this->boxes = array();
89
90 // Permissions
91 $this->rights = array();
92 $this->rights_class = 'prelevement';
93 $r = 0;
94 $r++;
95 $this->rights[$r][0] = 151;
96 $this->rights[$r][1] = 'Read direct debit payment orders';
97 $this->rights[$r][2] = 'r';
98 $this->rights[$r][3] = 0;
99 $this->rights[$r][4] = 'bons';
100 $this->rights[$r][5] = 'lire';
101
102 $r++;
103 $this->rights[$r][0] = 152;
104 $this->rights[$r][1] = 'Create/modify a direct debit payment order';
105 $this->rights[$r][2] = 'w';
106 $this->rights[$r][3] = 0;
107 $this->rights[$r][4] = 'bons';
108 $this->rights[$r][5] = 'creer';
109
110 $r++;
111 $this->rights[$r][0] = 153;
112 $this->rights[$r][1] = 'Send/Transmit direct debit payment orders';
113 $this->rights[$r][2] = 'a';
114 $this->rights[$r][3] = 0;
115 $this->rights[$r][4] = 'bons';
116 $this->rights[$r][5] = 'send';
117
118 $r++;
119 $this->rights[$r][0] = 154;
120 $this->rights[$r][1] = 'Record Credits/Rejects of direct debit payment orders';
121 $this->rights[$r][2] = 'a';
122 $this->rights[$r][3] = 0;
123 $this->rights[$r][4] = 'bons';
124 $this->rights[$r][5] = 'credit';
125
126 // Menus
127 //-------
128 $this->menu = 1; // This module add menu entries. They are coded into menu manager.
129 }
130
131
140 public function init($options = '')
141 {
142 global $conf;
143
144 // Permissions
145 $this->remove($options);
146
147 $sql = array(
148 "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".((int) $conf->entity),
149 "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".((int) $conf->entity).")",
150 );
151
152 return $this->_init($sql, $options);
153 }
154}
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
Class to describe and enable module of payment by Direct Debit.
init($options='')
Function called when module is enabled.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140