28 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
45 $this->numero = 50400;
47 $this->family =
"financial";
48 $this->module_position =
'61';
50 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
51 $this->
description =
"Double entry accounting management";
54 $this->version =
'dolibarr';
56 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
57 $this->picto =
'accounting';
60 $this->dirs = array(
'/accounting/temp');
63 $this->config_page_url = array();
66 $this->depends = array(
"modFacture",
"modBanque",
"modTax");
67 $this->requiredby = array();
68 $this->conflictwith = array(
"modComptabilite");
69 $this->phpmin = array(5, 4);
70 $this->need_dolibarr_version = array(3, 9);
71 $this->langfiles = array(
"accountancy",
"compta");
78 $this->
const = array();
79 $this->
const[1] = array(
80 "MAIN_COMPANY_CODE_ALWAYS_REQUIRED",
83 "With this constants on, third party code is always required whatever is numbering module behaviour", 0,
'current', 1
85 $this->
const[2] = array(
86 "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED",
89 "With this constants on, bank account number is always required", 0,
'current', 1
91 $this->
const[3] = array(
92 "ACCOUNTING_ACCOUNT_SUSPENSE",
97 $this->
const[4] = array(
98 "ACCOUNTING_ACCOUNT_TRANSFER_CASH",
103 $this->
const[5] = array(
109 $this->
const[6] = array(
110 "ACCOUNTING_EXPORT_MODELCSV",
115 $this->
const[7] = array(
116 "ACCOUNTING_LENGTH_GACCOUNT",
121 $this->
const[8] = array(
122 "ACCOUNTING_LENGTH_AACCOUNT",
127 $this->
const[9] = array(
128 "ACCOUNTING_LIST_SORT_VENTILATION_TODO",
133 $this->
const[10] = array(
134 "ACCOUNTING_LIST_SORT_VENTILATION_DONE",
139 $this->
const[11] = array(
140 "ACCOUNTING_EXPORT_DATE",
145 $this->
const[12] = array(
146 "ACCOUNTING_EXPORT_SEPARATORCSV",
151 $this->
const[13] = array(
152 "ACCOUNTING_EXPORT_FORMAT",
159 $this->tabs = array();
162 $this->module_parts = array();
165 $this->boxes = array(
166 0=>array(
'file'=>
'box_accountancy_last_manual_entries.php',
'enabledbydefaulton'=>
'accountancyindex'),
167 1=>array(
'file'=>
'box_accountancy_suspense_account.php',
'enabledbydefaulton'=>
'accountancyindex')
171 $this->rights_class =
'accounting';
173 $this->rights = array();
176 $this->rights[$r][0] = 50440;
177 $this->rights[$r][1] =
'Manage chart of accounts, setup of accountancy';
178 $this->rights[$r][2] =
'r';
179 $this->rights[$r][3] = 0;
180 $this->rights[$r][4] =
'chartofaccount';
181 $this->rights[$r][5] =
'';
184 $this->rights[$r][0] = 50401;
185 $this->rights[$r][1] =
'Bind products and invoices with accounting accounts';
186 $this->rights[$r][2] =
'r';
187 $this->rights[$r][3] = 0;
188 $this->rights[$r][4] =
'bind';
189 $this->rights[$r][5] =
'write';
192 $this->rights[$r][0] = 50411;
193 $this->rights[$r][1] =
'Read operations in Ledger';
194 $this->rights[$r][2] =
'r';
195 $this->rights[$r][3] = 0;
196 $this->rights[$r][4] =
'mouvements';
197 $this->rights[$r][5] =
'lire';
200 $this->rights[$r][0] = 50412;
201 $this->rights[$r][1] =
'Write/Edit operations in Ledger';
202 $this->rights[$r][2] =
'w';
203 $this->rights[$r][3] = 0;
204 $this->rights[$r][4] =
'mouvements';
205 $this->rights[$r][5] =
'creer';
208 $this->rights[$r][0] = 50414;
209 $this->rights[$r][1] =
'Delete operations in Ledger';
210 $this->rights[$r][2] =
'd';
211 $this->rights[$r][3] = 0;
212 $this->rights[$r][4] =
'mouvements';
213 $this->rights[$r][5] =
'supprimer';
216 $this->rights[$r][0] = 50415;
217 $this->rights[$r][1] =
'Delete all operations by year and journal in Ledger';
218 $this->rights[$r][2] =
'd';
219 $this->rights[$r][3] = 0;
220 $this->rights[$r][4] =
'mouvements';
221 $this->rights[$r][5] =
'supprimer_tous';
224 $this->rights[$r][0] = 50418;
225 $this->rights[$r][1] =
'Export operations of the Ledger';
226 $this->rights[$r][2] =
'r';
227 $this->rights[$r][3] = 0;
228 $this->rights[$r][4] =
'mouvements';
229 $this->rights[$r][5] =
'export';
232 $this->rights[$r][0] = 50420;
233 $this->rights[$r][1] =
'Report and export reports (turnover, balance, journals, ledger)';
234 $this->rights[$r][2] =
'r';
235 $this->rights[$r][3] = 0;
236 $this->rights[$r][4] =
'comptarapport';
237 $this->rights[$r][5] =
'lire';
240 $this->rights[$r][0] = 50430;
241 $this->rights[$r][1] =
'Manage fiscal periods, validate movements and close periods';
242 $this->rights[$r][2] =
'r';
243 $this->rights[$r][3] = 0;
244 $this->rights[$r][4] =
'fiscalyear';
245 $this->rights[$r][5] =
'write';
257 $this->export_code[$r] = $this->rights_class.
'_'.$r;
258 $this->export_label[$r] =
'Chartofaccounts';
259 $this->export_icon[$r] =
'accounting';
260 $this->export_permission[$r] = array(array(
"accounting",
"chartofaccount"));
261 $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.active'=>
'Status');
262 $this->export_TypeFields_array[$r] = array(
'ac.rowid'=>
'List:accounting_system:pcg_version',
'ac.pcg_version'=>
'Text',
'aa.rowid'=>
'Numeric',
'aa.account_number'=>
"Text",
'aa.label'=>
"Text",
'aa.account_parent'=>
"Text",
'aa.pcg_type'=>
'Text',
'aa.active'=>
'Status');
263 $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_active'=>
"Accounting");
265 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
266 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'accounting_account as aa';
267 $this->export_sql_end[$r] .=
' ,'.MAIN_DB_PREFIX.
'accounting_system as ac';
268 $this->export_sql_end[$r] .=
' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity(
'accounting').
') ';
277 $this->import_code[$r] = $this->rights_class.
'_'.$r;
278 $this->import_label[$r] =
'ImportAccountingEntries';
279 $this->import_icon[$r] = $this->picto;
280 $this->import_entities_array[$r] = array();
281 $this->import_tables_array[$r] = array(
'b'=>MAIN_DB_PREFIX.
'accounting_bookkeeping');
282 $this->import_fields_array[$r] = array(
283 'b.piece_num'=>
"TransactionNumShort",
284 'b.doc_date'=>
"Docdate",
286 'b.doc_ref'=>
'Piece',
287 'b.code_journal'=>
'Codejournal',
289 'b.numero_compte'=>
'AccountAccounting',
291 'b.subledger_account'=>
'SubledgerAccount',
292 'b.subledger_label'=>
'SubledgerAccountLabel',
293 'b.label_operation'=>
'LabelOperation',
295 'b.credit'=>
"Credit",
296 'b.sens'=>
'Direction'
298 $this->import_fieldshidden_array[$r] = array(
'b.doc_type'=>
'const-import_from_external',
'b.fk_doc'=>
'const-0',
'b.fk_docdet'=>
'const-0',
'b.fk_user_author'=>
'user->id',
'b.date_creation'=>
'const-'.
dol_print_date(
dol_now(),
'standard'));
299 $this->import_regex_array[$r] = array(
'b.doc_date'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
300 $this->import_examplevalues_array[$r] = array(
301 'b.piece_num'=>
'123 (!!! use next value not already used)',
304 'b.doc_ref'=>
'My document ABC',
305 'b.code_journal'=>
"VTE",
307 'b.numero_compte'=>
"707",
309 'b.subledger_account'=>
'',
310 'b.subledger_label'=>
'',
311 'b.label_operation'=>
"Sale of ABC",
319 $this->import_code[$r] = $this->rights_class.
'_'.$r;
320 $this->import_label[$r] =
"Chartofaccounts";
321 $this->import_icon[$r] = $this->picto;
322 $this->import_entities_array[$r] = array();
323 $this->import_tables_array[$r] = array(
'aa'=>MAIN_DB_PREFIX.
'accounting_account');
324 $this->import_tables_creator_array[$r] = array(
'aa'=>
'fk_user_author');
325 $this->import_fields_array[$r] = array(
'aa.fk_pcg_version'=>
"Chartofaccounts*",
'aa.account_number'=>
"AccountAccounting*",
'aa.label'=>
"Label*",
'aa.account_parent'=>
"Accountparent",
"aa.fk_accounting_category"=>
"AccountingCategory",
"aa.pcg_type"=>
"Pcgtype*",
'aa.active'=>
'Status*',
'aa.datec'=>
"DateCreation");
326 $this->import_regex_array[$r] = array(
'aa.fk_pcg_version'=>
'pcg_version@'.MAIN_DB_PREFIX.
'accounting_system',
'aa.account_number'=>
'^.{1,32}$',
'aa.label'=>
'^.{1,255}$',
'aa.account_parent'=>
'^.{0,32}$',
'aa.fk_accounting_category'=>
'rowid@'.MAIN_DB_PREFIX.
'c_accounting_category',
'aa.pcg_type'=>
'^.{1,20}$',
'aa.active'=>
'^0|1$',
'aa.datec'=>
'^\d{4}-\d{2}-\d{2}$');
327 $this->import_convertvalue_array[$r] = array(
328 'aa.account_parent'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/accountancy/class/accountingaccount.class.php',
'class'=>
'AccountingAccount',
'method'=>
'fetch',
'element'=>
'AccountingAccount'),
329 'aa.fk_accounting_category'=>array(
'rule'=>
'fetchidfromcodeorlabel',
'classfile'=>
'/accountancy/class/accountancycategory.class.php',
'class'=>
'AccountancyCategory',
'method'=>
'fetch',
'dict'=>
'DictionaryAccountancyCategory'),
331 $this->import_examplevalues_array[$r] = array(
'aa.fk_pcg_version'=>
"PCG99-ABREGE",
'aa.account_number'=>
"707",
'aa.label'=>
"Product sales",
'aa.account_parent'=>
"ref:7 or id:1407",
"aa.fk_accounting_category"=>
"",
"aa.pcg_type"=>
"PROD",
'aa.active'=>
'1',
'aa.datec'=>
"2017-04-28");
332 $this->import_updatekeys_array[$r] = array(
'aa.fk_pcg_version'=>
'Chartofaccounts',
'aa.account_number'=>
'AccountAccounting');
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
dol_now($mode= 'auto')
Return date for now.
Description and activation class for module accounting expert.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
__construct($db)
Constructor.