dolibarr  9.0.0
modLoan.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  * or see http://www.gnu.org/
17  */
18 
26 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27 
28 
32 class modLoan extends DolibarrModules
33 {
34 
40  function __construct($db)
41  {
42  global $conf;
43 
44  $this->db = $db;
45  $this->numero = 520;
46 
47  $this->family = "financial";
48  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
49  $this->name = preg_replace('/^mod/i','',get_class($this));
50  // Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
51  $this->description = "Loans management";
52 
53  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
54  $this->version = 'dolibarr';
55 
56  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
57  $this->picto='bill';
58 
59  // Data directories to create when module is enabled
60  $this->dirs = array("/loan/temp");
61 
62  // Config pages
63  $this->config_page_url = array('loan.php');
64 
65  // Dependencies
66  $this->hidden = false; // A condition to hide module
67  $this->depends = array(); // 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(5,4); // Minimum version of PHP required by module
71  $this->langfiles = array("loan");
72 
73  // Constants
74  $this->const = array();
75  $this->const[0] = array(
76  "LOAN_ACCOUNTING_ACCOUNT_CAPITAL",
77  "chaine",
78  "164"
79  );
80  $this->const[1] = array(
81  "LOAN_ACCOUNTING_ACCOUNT_INTEREST",
82  "chaine",
83  "6611"
84  );
85  $this->const[1] = array(
86  "LOAN_ACCOUNTING_ACCOUNT_INSURANCE",
87  "chaine",
88  "6162"
89  );
90 
91  // Boxes
92  $this->boxes = array();
93 
94  // Permissions
95  $this->rights = array();
96  $this->rights_class = 'loan';
97  $r=0;
98 
99  $r++;
100  $this->rights[$r][0] = 520;
101  $this->rights[$r][1] = 'Read loans';
102  $this->rights[$r][2] = 'r';
103  $this->rights[$r][3] = 0;
104  $this->rights[$r][4] = 'read';
105  $this->rights[$r][5] = '';
106 
107  $r++;
108  $this->rights[$r][0] = 522;
109  $this->rights[$r][1] = 'Create/modify loans';
110  $this->rights[$r][2] = 'w';
111  $this->rights[$r][3] = 0;
112  $this->rights[$r][4] = 'write';
113  $this->rights[$r][5] = '';
114 
115  $r++;
116  $this->rights[$r][0] = 524;
117  $this->rights[$r][1] = 'Delete loans';
118  $this->rights[$r][2] = 'd';
119  $this->rights[$r][3] = 0;
120  $this->rights[$r][4] = 'delete';
121  $this->rights[$r][5] = '';
122 
123  $r++;
124  $this->rights[$r][0] = 525;
125  $this->rights[$r][1] = 'Access loan calculator';
126  $this->rights[$r][2] = 'r';
127  $this->rights[$r][3] = 0;
128  $this->rights[$r][4] = 'calc';
129  $this->rights[$r][5] = '';
130 
131  $r++;
132  $this->rights[$r][0] = 527;
133  $this->rights[$r][1] = 'Export loans';
134  $this->rights[$r][2] = 'r';
135  $this->rights[$r][3] = 0;
136  $this->rights[$r][4] = 'export';
137  $this->rights[$r][5] = '';
138 
139 
140  // Menus
141  //-------
142  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
143 
144 
145  // Exports
146  //--------
147  $r=0;
148  }
149 
150 
159  function init($options='')
160  {
161  global $conf;
162 
163  // Clean before activation
164  $this->remove($options);
165 
166  $sql = array();
167 
168  return $this->_init($sql,$options);
169  }
170 }
Class DolibarrModules.
</td >< td class="liste_titre" align="right"></td ></tr >< tr class="liste_titre">< input type="checkbox" onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< tr class="oddeven">< td >< input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td >< td >< input type="checkbox" class="check" name="choose'.$i.'"></td >< td class="nowrap"></td >< td >< input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:573
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
__construct($db)
Constructor.
Class to manage loan module.
_init($array_sql, $options='')
Enables a module.
init($options='')
Function called when module is enabled.