dolibarr 21.0.0-beta
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3 * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
4 * Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
5 * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
6 * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
7 * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
8 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
9 * Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
10 * Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
11 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
33// Load Dolibarr environment
34require '../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
39
48// Load translation files required by the page
49$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
50
51// Security access
52if (!$user->hasRight('accounting', 'chartofaccount')) {
54}
55
56$action = GETPOST('action', 'aZ09');
57
58$nbletter = GETPOSTINT('ACCOUNTING_LETTERING_NBLETTERS');
59
60// Parameters ACCOUNTING_* and others
61$list = array(
62 'ACCOUNTING_LENGTH_GACCOUNT',
63 'ACCOUNTING_LENGTH_AACCOUNT',
64);
65
66$list_binding = array(
67 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER',
68 'ACCOUNTING_DATE_START_BINDING',
69 'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER'
70);
71
72// Parameters for export options
73$main_option = array(
74 'ACCOUNTING_EXPORT_PREFIX_SPEC',
75);
76
77$accountancyexport = new AccountancyExport($db);
78$configuration = $accountancyexport->getTypeConfig();
79
80$listparam = $configuration['param'];
81$listformat = $configuration['format'];
82$listcr = $configuration['cr'];
83
84$model_option = array(
85 '1' => array(
86 'label' => 'ACCOUNTING_EXPORT_FORMAT',
87 'param' => $listformat,
88 ),
89 '2' => array(
90 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
91 'param' => '',
92 ),
93 '3' => array(
94 'label' => 'ACCOUNTING_EXPORT_ENDLINE',
95 'param' => $listcr,
96 ),
97 '4' => array(
98 'label' => 'ACCOUNTING_EXPORT_DATE',
99 'param' => '',
100 ),
101);
102
103$error = 0;
104
105
106/*
107 * Actions
108 */
109
110if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_ER_DATE_RECORD', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO', 'setACCOUNTING_BANK_CONCILIATED'))) {
111 $constname = preg_replace('/^set/', '', $action);
112 $constvalue = GETPOSTINT('value');
113 $res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
114 if (!($res > 0)) {
115 $error++;
116 }
117
118 if (!$error) {
119 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
120 } else {
121 setEventMessages($langs->trans("Error"), null, 'mesgs');
122 }
123}
124
125if ($action == 'update') {
126 $error = 0;
127
128 if (!$error) {
129 foreach ($list as $constname) {
130 $constvalue = GETPOST($constname, 'alpha');
131 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
132 $error++;
133 }
134 }
135 if ($error) {
136 setEventMessages($langs->trans("Error"), null, 'errors');
137 }
138
139 // option in section binding
140 foreach ($list_binding as $constname) {
141 $constvalue = GETPOST($constname, 'alpha');
142
143 if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
144 $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year'));
145 }
146
147 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
148 $error++;
149 }
150 }
151
152 // options in section other
153 if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) {
154 if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) {
155 $error++;
156 }
157 }
158
159 // Export options
160 $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV');
161
162 if (!empty($modelcsv)) {
163 if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
164 $error++;
165 }
166 //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
167 // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
168 //}
169 } else {
170 $error++;
171 }
172
173 foreach ($main_option as $constname) {
174 $constvalue = GETPOST($constname, 'alpha');
175
176 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
177 $error++;
178 }
179 }
180
181 foreach ($listparam[$modelcsv] as $key => $value) {
182 $constante = $key;
183
184 if (strpos($constante, 'ACCOUNTING') !== false) {
185 $constvalue = GETPOST($key, 'alpha');
186 if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
187 $error++;
188 }
189 }
190 }
191
192 if (!$error) {
193 // reload
194 $configuration = $accountancyexport->getTypeConfig();
195 $listparam = $configuration['param'];
196 }
197 }
198
199 if (!$error) {
200 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
201 } else {
202 setEventMessages($langs->trans("Error"), null, 'errors');
203 }
204}
205
206if ($action == 'setmanagezero') {
207 $setmanagezero = GETPOSTINT('value');
208 $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
209 if (!($res > 0)) {
210 $error++;
211 }
212
213 if (!$error) {
214 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
215 } else {
216 setEventMessages($langs->trans("Error"), null, 'mesgs');
217 }
218}
219
220if ($action == 'setenabledraftexport') {
221 $setenabledraftexport = GETPOSTINT('value');
222 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
223 if (!($res > 0)) {
224 $error++;
225 }
226
227 if (!$error) {
228 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
229 } else {
230 setEventMessages($langs->trans("Error"), null, 'mesgs');
231 }
232}
233
234if ($action == 'setenablesubsidiarylist') {
235 $setenablesubsidiarylist = GETPOSTINT('value');
236 $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
237 if (!($res > 0)) {
238 $error++;
239 }
240
241 if (!$error) {
242 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
243 } else {
244 setEventMessages($langs->trans("Error"), null, 'mesgs');
245 }
246}
247
248if ($action == 'setdisablebindingonsales') {
249 $setdisablebindingonsales = GETPOSTINT('value');
250 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
251 if (!($res > 0)) {
252 $error++;
253 }
254
255 if (!$error) {
256 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
257 } else {
258 setEventMessages($langs->trans("Error"), null, 'mesgs');
259 }
260}
261
262if ($action == 'setdisablebindingonpurchases') {
263 $setdisablebindingonpurchases = GETPOSTINT('value');
264 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
265 if (!($res > 0)) {
266 $error++;
267 }
268
269 if (!$error) {
270 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
271 } else {
272 setEventMessages($langs->trans("Error"), null, 'mesgs');
273 }
274}
275
276if ($action == 'setdisablebindingonexpensereports') {
277 $setdisablebindingonexpensereports = GETPOSTINT('value');
278 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
279 if (!($res > 0)) {
280 $error++;
281 }
282
283 if (!$error) {
284 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
285 } else {
286 setEventMessages($langs->trans("Error"), null, 'mesgs');
287 }
288}
289
290if ($action == 'setenablelettering') {
291 $setenablelettering = GETPOSTINT('value');
292 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
293 if (!($res > 0)) {
294 $error++;
295 }
296
297 if (!$error) {
298 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
299 } else {
300 setEventMessages($langs->trans("Error"), null, 'mesgs');
301 }
302}
303
304if ($action == 'setenableautolettering') {
305 $setenableautolettering = GETPOSTINT('value');
306 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
307 if (!($res > 0)) {
308 $error++;
309 }
310
311 if (!$error) {
312 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
313 } else {
314 setEventMessages($langs->trans("Error"), null, 'mesgs');
315 }
316}
317
318if ($action == 'setenablevatreversecharge') {
319 $setenablevatreversecharge = GETPOSTINT('value');
320 $res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
321 if (!($res > 0)) {
322 $error++;
323 }
324
325 if (!$error) {
326 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
327 } else {
328 setEventMessages($langs->trans("Error"), null, 'mesgs');
329 }
330}
331
332
333/*
334 * View
335 */
336
337$form = new Form($db);
338
339$title = $langs->trans('ConfigAccountingExpert');
340$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
341llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_index');
342
343
344$linkback = '';
345//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
346print load_fiche_titre($title, $linkback, 'accountancy');
347
348
349// Show message if accountancy hidden options are activated to help to resolve some problems
350if (!$user->admin) {
351 if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
352 print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
353 }
354 if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
355 print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
356 }
357 if (getDolGlobalString('ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY')) {
358 print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
359 }
360 if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
361 print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
362 }
363 if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
364 print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
365 }
366}
367
368print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
369print '<input type="hidden" name="token" value="'.newToken().'">';
370print '<input type="hidden" name="action" value="update">';
371print '<input type="hidden" name="page_y" value="">';
372
373// Params
374print '<div class="div-table-responsive-no-min">';
375print '<table class="noborder centpercent">';
376print '<tr class="liste_titre">';
377print '<td colspan="2">'.$langs->trans('Options').'</td>';
378print "</tr>\n";
379
380// TO DO Mutualize code for yes/no constants
381
382/* Set this option as a hidden option but keep it for some needs.
383print '<tr>';
384print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
385if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL')) {
386 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=0">';
387 print img_picto($langs->trans("Activated"), 'switch_on');
388 print '</a></td>';
389} else {
390 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=1">';
391 print img_picto($langs->trans("Disabled"), 'switch_off');
392 print '</a></td>';
393}
394print '</tr>';
395*/
396
397print '<tr class="oddeven">';
398print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
399if (getDolGlobalString('BANK_DISABLE_DIRECT_INPUT')) {
400 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=0">';
401 print img_picto($langs->trans("Activated"), 'switch_on');
402 print '</a></td>';
403} else {
404 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
405 print img_picto($langs->trans("Disabled"), 'switch_off');
406 print '</a></td>';
407}
408print '</tr>';
409
410print '<tr class="oddeven">';
411print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
412print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';
413print '</td>';
414
415if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
416 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
417 print img_picto($langs->trans("Activated").' - '.$langs->trans("NotRecommended"), 'switch_on', 'class="warning"');
418 print '</a></td>';
419} else {
420 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
421 print img_picto($langs->trans("Disabled"), 'switch_off');
422 print '</a></td>';
423}
424print '</tr>';
425
426print '<tr class="oddeven">';
427print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
428if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) {
429 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=0">';
430 print img_picto($langs->trans("Activated"), 'switch_on');
431 print '</a></td>';
432} else {
433 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=1">';
434 print img_picto($langs->trans("Disabled"), 'switch_off');
435 print '</a></td>';
436}
437print '</tr>';
438
439// Param a user $user->hasRight('accounting', 'chartofaccount') can access
440foreach ($list as $key) {
441 print '<tr class="oddeven value">';
442
443 if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO') && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
444 continue;
445 }
446
447 // Param
448 $label = $langs->trans($key);
449 print '<td>'.$label.'</td>';
450 // Value
451 print '<td class="right">';
452 print '<input type="number" class="maxwidth50 right" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
453
454 print '</td>';
455 print '</tr>';
456}
457
458print '</table>';
459
460print '<div class="center"><input type="submit" class="button reposition" value="'.dol_escape_htmltag($langs->trans('Save')).'" name="button"></div>';
461
462print '</div>';
463
464print '<br><br>';
465
466// Binding params
467print '<div class="div-table-responsive-no-min">';
468print '<table class="noborder centpercent">';
469print '<tr class="liste_titre">';
470print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
471print "</tr>\n";
472
473// Param a user $user->hasRight('accounting', 'chartofaccount') can access
474foreach ($list_binding as $key) {
475 print '<tr class="oddeven value">';
476
477 // Param
478 $label = $langs->trans($key);
479 print '<td>'.$label.'</td>';
480 // Value
481 print '<td class="right minwidth75imp parentonrightofpage">';
482 if ($key == 'ACCOUNTING_DATE_START_BINDING') {
483 print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
484 } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
485 $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
486 print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width200');
487 } elseif ($key == 'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') {
488 $array = array(
489 0=>$langs->trans("ThirdPartyName") . ' - ' . $langs->trans("NumPiece") . ' - ' . $langs->trans("LabelAccount"),
490 1=>$langs->trans("ThirdPartyName") . ' - ' . $langs->trans("NumPiece"),
491 2=>$langs->trans("ThirdPartyName")
492 );
493 print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width200');
494 } else {
495 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
496 }
497
498 print '</td>';
499 print '</tr>';
500}
501
502print '<tr class="oddeven">';
503print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
504if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
505 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
506 print img_picto($langs->trans("Activated"), 'switch_on', '', 0, 0, 0, '', 'warning');
507 print '</a></td>';
508} else {
509 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
510 print img_picto($langs->trans("Disabled"), 'switch_off');
511 print '</a></td>';
512}
513print '</tr>';
514
515print '<tr class="oddeven">';
516print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
517if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) {
518 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
519 print img_picto($langs->trans("Activated"), 'switch_on', '', 0, 0, 0, '', 'warning');
520 print '</a></td>';
521} else {
522 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
523 print img_picto($langs->trans("Disabled"), 'switch_off');
524 print '</a></td>';
525}
526print '</tr>';
527
528print '<tr class="oddeven">';
529print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
530if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
531 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
532 print img_picto($langs->trans("Activated"), 'switch_on', '', 0, 0, 0, '', 'warning');
533 print '</a></td>';
534} else {
535 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';
536 print img_picto($langs->trans("Disabled"), 'switch_off');
537 print '</a></td>';
538}
539print '</tr>';
540
541if (!getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
542 print '<tr class="oddeven">';
543 print '<td>'.$langs->trans("ACCOUNTANCY_ER_DATE_RECORD").'</td>';
544 if (getDolGlobalInt('ACCOUNTANCY_ER_DATE_RECORD')) {
545 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_ER_DATE_RECORD&value=0">';
546 print img_picto($langs->trans("Activated"), 'switch_on');
547 print '</a></td>';
548 } else {
549 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_ER_DATE_RECORD&value=1">';
550 print img_picto($langs->trans("Disabled"), 'switch_off');
551 print '</a></td>';
552 }
553 print '</tr>';
554}
555
556print '<tr class="oddeven">';
557print '<td>'.$langs->trans("ACCOUNTING_BANK_CONCILIATED").'</td>';
558if (getDolGlobalInt('ACCOUNTING_BANK_CONCILIATED') == 2) {
559 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_BANK_CONCILIATED&value=1">';
560 print img_picto($langs->trans("Activated"), 'switch_on');
561 print '</a></td>';
562} else {
563 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_BANK_CONCILIATED&value=2">';
564 print img_picto($langs->trans("Disabled"), 'switch_off');
565 print '</a></td>';
566}
567print '</tr>';
568
569print '</table>';
570print '</div>';
571
572print '<div class="center"><input type="submit" class="button reposition" value="'.dol_escape_htmltag($langs->trans('Save')).'" name="button"></div>';
573
574
575
576// Show advanced options
577print '<br><br>';
578
579
580// Advanced params
581print '<div class="div-table-responsive-no-min">';
582print '<table class="noborder centpercent">';
583print '<tr class="liste_titre">';
584print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
585print "</tr>\n";
586
587print '<tr class="oddeven">';
588print '<td>';
589print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
590if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
591 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
592 print img_picto($langs->trans("Activated"), 'switch_on');
593 print '</a></td>';
594} else {
595 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
596 print img_picto($langs->trans("Disabled"), 'switch_off');
597 print '</a></td>';
598}
599print '</tr>';
600
601if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
602 // Number of letters for lettering (3 by default (AAA), min 2 (AA))
603 print '<tr class="oddeven">';
604 print '<td>';
605 print $form->textwithpicto($langs->trans("ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans("ACCOUNTING_LETTERING_NBLETTERS_DESC")) . '</td>';
606 print '<td class="right">';
607
608 if (empty($letter)) {
609 if (getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS')) {
610 $nbletter = getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS');
611 } else {
612 $nbletter = 3;
613 }
614 }
615
616 print '<input class="flat right" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="' . $nbletter . '" type="number" step="1" min="2" max="3" >' . "\n";
617 print '</tr>';
618
619 // Auto Lettering when transfer in accountancy is realized
620 print '<tr class="oddeven">';
621 print '<td>';
622 print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
623 if (getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
624 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
625 print img_picto($langs->trans("Activated"), 'switch_on');
626 print '</a></td>';
627 } else {
628 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">';
629 print img_picto($langs->trans("Disabled"), 'switch_off');
630 print '</a></td>';
631 }
632 print '</tr>';
633}
634
635print '<tr class="oddeven">';
636print '<td>';
637print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
638if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
639 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
640 print img_picto($langs->trans("Activated"), 'switch_on');
641 print '</a></td>';
642} else {
643 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
644 print img_picto($langs->trans("Disabled"), 'switch_off');
645 print '</a></td>';
646}
647print '</tr>';
648
649print '</table>';
650print '</div>';
651
652
653print '<div class="center"><input type="submit" class="button button-edit reposition" name="button" value="'.$langs->trans('Save').'"></div>';
654
655print '<br><br>';
656
657
658// Export options
659
660print "\n".'<script type="text/javascript">'."\n";
661print 'jQuery(document).ready(function () {'."\n";
662print ' function initfields()'."\n";
663print ' {'."\n";
664foreach ($listparam as $key => $param) {
665 print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
666 print ' {'."\n";
667 print ' //console.log("'.$param['label'].'");'."\n";
668 if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) {
669 print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.getDolGlobalString('ACCOUNTING_EXPORT_FORMAT').'");'."\n";
670 print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
671 } else {
672 print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
673 print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
674 }
675 if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) {
676 print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
677 print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
678 } else {
679 print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV').'");'."\n";
680 print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
681 }
682 if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
683 print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
684 } else {
685 print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
686 }
687 if (empty($param['ACCOUNTING_EXPORT_DATE'])) {
688 print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
689 print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
690 } else {
691 print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.getDolGlobalString('ACCOUNTING_EXPORT_DATE').'");'."\n";
692 print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
693 }
694 print ' }'."\n";
695}
696print ' }'."\n";
697print ' initfields();'."\n";
698print ' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'."\n";
699print ' initfields();'."\n";
700print ' });'."\n";
701print '})'."\n";
702print '</script>'."\n";
703
704// Main Options
705
706print '<table class="noborder centpercent">';
707print '<tr class="liste_titre">';
708print '<td colspan="2">'.$langs->trans('ExportOptions').'</td>';
709print "</tr>\n";
710
711$num = count($main_option);
712if ($num) {
713 foreach ($main_option as $key) {
714 print '<tr class="oddeven value">';
715
716 // Param
717 $label = $langs->trans($key);
718 print '<td>'.dol_escape_htmltag($label).'</td>';
719
720 // Value
721 print '<td>';
722 print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
723 print '</td></tr>';
724 }
725}
726
727print '<tr class="oddeven">';
728print '<td>'.$langs->trans("Selectmodelcsv").'</td>';
729if (!$conf->use_javascript_ajax) {
730 print '<td class="nowrap">';
731 print $langs->trans("NotAvailableWhenAjaxDisabled");
732 print "</td>";
733} else {
734 print '<td>';
735 $listofexporttemplates = $accountancyexport->getType(1);
736 print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates, getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0, '', 0, 0, 0, '', '', 1);
737 print '</td>';
738}
739print "</tr>";
740
741
742$num2 = count($model_option);
743if ($num2) {
744 foreach ($model_option as $key) {
745 print '<tr class="oddeven value">';
746
747 // Param
748 $label = $key['label'];
749 print '<td>'.$langs->trans($label).'</td>';
750
751 // Value
752 print '<td>';
753 if (is_array($key['param'])) {
754 print $form->selectarray($label, $key['param'], getDolGlobalString($label), 0);
755 } else {
756 print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.getDolGlobalString($label).'">';
757 }
758
759 print '</td></tr>';
760 }
761
762 print "</table>\n";
763}
764
765print '<div class="center"><input type="submit" class="button reposition" value="'.dol_escape_htmltag($langs->trans('Save')).'" name="button"></div>';
766
767
768print '</form>';
769
770// End of page
771llxFooter();
772$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Manage the different format accountancy export.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.