dolibarr  7.0.0-beta
modAccounting.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3  * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
4  * Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
5  * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
6  * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
27 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
28 
33 {
39  function __construct($db)
40  {
41  global $conf;
42 
43  $this->db = $db;
44  $this->numero = 50400;
45 
46  $this->family = "financial";
47  $this->module_position = 610;
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  $this->description = "Advanced accounting management";
51 
52  // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
53  $this->version = 'dolibarr';
54 
55  $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
56  $this->special = 0;
57  $this->picto = 'accounting';
58 
59  // Data directories to create when module is enabled
60  $this->dirs = array('/accounting/temp');
61 
62  // Config pages
63  $this->config_page_url = array();
64 
65  // Dependencies
66  $this->depends = array("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled
67  $this->requiredby = array(); // List of modules id to disable if this one is disabled
68  $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
69  $this->phpmin = array(5, 3); // Minimum version of PHP required by module
70  $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module
71  $this->langfiles = array("accountancy","compta");
72 
73  // Constants
74  $this->const = array();
75  $this->const[1] = array(
76  "MAIN_COMPANY_CODE_ALWAYS_REQUIRED",
77  "chaine",
78  "1",
79  "With this constants on, third party code is always required whatever is numbering module behaviour"
80  );
81  $this->const[2] = array(
82  "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED",
83  "chaine",
84  "1",
85  "With this constants on, bank account number is always required"
86  );
87  $this->const[3] = array(
88  "ACCOUNTING_ACCOUNT_SUSPENSE",
89  "chaine",
90  "471"
91  );
92  $this->const[4] = array(
93  "ACCOUNTING_ACCOUNT_TRANSFER_CASH",
94  "chaine",
95  "58"
96  );
97  $this->const[5] = array(
98  "CHARTOFACCOUNTS",
99  "chaine",
100  "2"
101  );
102  $this->const[6] = array(
103  "ACCOUNTING_EXPORT_MODELCSV",
104  "chaine",
105  "1"
106  );
107  $this->const[7] = array(
108  "ACCOUNTING_LENGTH_GACCOUNT",
109  "chaine",
110  ""
111  );
112  $this->const[8] = array(
113  "ACCOUNTING_LENGTH_AACCOUNT",
114  "chaine",
115  ""
116  );
117  $this->const[9] = array(
118  "ACCOUNTING_LIST_SORT_VENTILATION_TODO",
119  "yesno",
120  "1"
121  );
122  $this->const[10] = array(
123  "ACCOUNTING_LIST_SORT_VENTILATION_DONE",
124  "yesno",
125  "1"
126  );
127  $this->const[11] = array (
128  "ACCOUNTING_EXPORT_DATE",
129  "chaine",
130  "%d%m%Y"
131  );
132  $this->const[12] = array(
133  "ACCOUNTING_EXPORT_SEPARATORCSV",
134  "string",
135  ","
136  );
137  $this->const[13] = array(
138  "ACCOUNTING_EXPORT_FORMAT",
139  "chaine",
140  "csv"
141  );
142 
143  // Tabs
144  $this->tabs = array();
145 
146  // Css
147  $this->module_parts = array();
148 
149  // Boxes
150  $this->boxes = array();
151 
152  // Permissions
153  $this->rights_class = 'accounting';
154 
155  $this->rights = array(); // Permission array used by this module
156  $r = 0;
157 
158  $this->rights[$r][0] = 50440;
159  $this->rights[$r][1] = 'Manage chart of accounts, setup of accountancy';
160  $this->rights[$r][2] = 'r';
161  $this->rights[$r][3] = 0;
162  $this->rights[$r][4] = 'chartofaccount';
163  $this->rights[$r][5] = '';
164  $r++;
165 
166  $this->rights[$r][0] = 50401;
167  $this->rights[$r][1] = 'Bind products and invoices with accounting accounts';
168  $this->rights[$r][2] = 'r';
169  $this->rights[$r][3] = 0;
170  $this->rights[$r][4] = 'bind';
171  $this->rights[$r][5] = 'write';
172  $r++;
173 
174  /*
175  $this->rights[$r][0] = 50402;
176  $this->rights[$r][1] = 'Make binding with products and invoices';
177  $this->rights[$r][2] = 'r';
178  $this->rights[$r][3] = 0;
179  $this->rights[$r][4] = 'ventilation';
180  $this->rights[$r][5] = 'dispatch_advanced';
181  $r++;
182  */
183 
184  $this->rights[$r][0] = 50411;
185  $this->rights[$r][1] = 'Read operations in Ledger';
186  $this->rights[$r][2] = 'r';
187  $this->rights[$r][3] = 0;
188  $this->rights[$r][4] = 'mouvements';
189  $this->rights[$r][5] = 'lire';
190  $r++;
191 
192  $this->rights[$r][0] = 50412;
193  $this->rights[$r][1] = 'Write/Edit operations in Ledger';
194  $this->rights[$r][2] = 'w';
195  $this->rights[$r][3] = 0;
196  $this->rights[$r][4] = 'mouvements';
197  $this->rights[$r][5] = 'creer';
198  $r++;
199 
200  $this->rights[$r][0] = 50420;
201  $this->rights[$r][1] = 'Report and export reports (turnover, balance, journals, ledger)';
202  $this->rights[$r][2] = 'r';
203  $this->rights[$r][3] = 0;
204  $this->rights[$r][4] = 'comptarapport';
205  $this->rights[$r][5] = 'lire';
206  $r++;
207 
208  $this->rights[$r][0] = 50430;
209  $this->rights[$r][1] = 'Define and close a fiscal year';
210  $this->rights[$r][2] = 'r';
211  $this->rights[$r][3] = 0;
212  $this->rights[$r][4] = 'fiscalyear';
213  $this->rights[$r][5] = '';
214  $r++;
215 
216 
217  // Menus
218  //-------
219  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
220 
221  // Exports
222  //--------
223  $r=0;
224 
225  $r++;
226  $this->export_code[$r]=$this->rights_class.'_'.$r;
227  $this->export_label[$r]='Chartofaccounts';
228  $this->export_icon[$r]='accounting';
229  $this->export_permission[$r]=array(array("accounting","chartofaccount"));
230  $this->export_fields_array[$r]=array('ac.rowid'=>'ChartofaccountsId','ac.pcg_version'=>'Chartofaccounts','aa.rowid'=>'Id','aa.account_number'=>"AccountAccounting",'aa.label'=>"Label",'aa.account_parent'=>"Accountparent",'aa.pcg_type'=>"Pcgtype",'aa.pcg_subtype'=>'Pcgsubtype','aa.active'=>'Status');
231  $this->export_TypeFields_array[$r]=array('ac.rowid'=>'List:accounting_system:pcg_version','aa.account_number'=>"Text",'aa.label'=>"Text",'aa.pcg_type'=>'Text','aa.pcg_subtype'=>'Text','aa.active'=>'Status');
232  $this->export_entities_array[$r]=array('ac.rowid'=>"accounting",'ac.pcg_version'=>"accounting",'aa.rowid'=>'accounting','aa.account_number'=>"accounting",'aa.label'=>"accounting",'aa.accountparent'=>"accounting",'aa.pcg_type'=>"accounting",'aa.pcgsubtype'=>"accounting",'aa_active'=>"accounting");
233 
234  $this->export_sql_start[$r]='SELECT DISTINCT ';
235  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa, '.MAIN_DB_PREFIX.'accounting_system as ac';
236  $this->export_sql_end[$r] .=' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') ';
237 
238  }
239 }
Class DolibarrModules.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="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< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
Description and activation class for module accounting expert.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
__construct($db)
Constructor.