dolibarr 21.0.0-alpha
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 <aspangaro@easya.solutions>
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 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32// Load Dolibarr environment
33require '../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
37
38// Load translation files required by the page
39$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
40
41// Security access
42if (!$user->hasRight('accounting', 'chartofaccount')) {
44}
45
46$action = GETPOST('action', 'aZ09');
47
48$nbletter = GETPOSTINT('ACCOUNTING_LETTERING_NBLETTERS');
49
50// Parameters ACCOUNTING_* and others
51$list = array(
52 'ACCOUNTING_LENGTH_GACCOUNT',
53 'ACCOUNTING_LENGTH_AACCOUNT',
54);
55
56$list_binding = array(
57 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER',
58 'ACCOUNTING_DATE_START_BINDING',
59);
60
61$error = 0;
62
63
64/*
65 * Actions
66 */
67
68if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_ER_DATE_RECORD', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO', 'setACCOUNTING_BANK_CONCILIATED'))) {
69 $constname = preg_replace('/^set/', '', $action);
70 $constvalue = GETPOSTINT('value');
71 $res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
72 if (!($res > 0)) {
73 $error++;
74 }
75
76 if (!$error) {
77 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
78 } else {
79 setEventMessages($langs->trans("Error"), null, 'mesgs');
80 }
81}
82
83if ($action == 'update') {
84 $error = 0;
85
86 if (!$error) {
87 foreach ($list as $constname) {
88 $constvalue = GETPOST($constname, 'alpha');
89 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
90 $error++;
91 }
92 }
93 if ($error) {
94 setEventMessages($langs->trans("Error"), null, 'errors');
95 }
96
97 // option in section binding
98 foreach ($list_binding as $constname) {
99 $constvalue = GETPOST($constname, 'alpha');
100
101 if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
102 $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year'));
103 }
104
105 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
106 $error++;
107 }
108 }
109
110 // options in section other
111 if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) {
112 if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) {
113 $error++;
114 }
115 }
116
117 if ($error) {
118 setEventMessages($langs->trans("Error"), null, 'errors');
119 }
120 }
121
122 if (!$error) {
123 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
124 }
125}
126
127if ($action == 'setmanagezero') {
128 $setmanagezero = GETPOSTINT('value');
129 $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
130 if (!($res > 0)) {
131 $error++;
132 }
133
134 if (!$error) {
135 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
136 } else {
137 setEventMessages($langs->trans("Error"), null, 'mesgs');
138 }
139}
140
141if ($action == 'setenabledraftexport') {
142 $setenabledraftexport = GETPOSTINT('value');
143 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
144 if (!($res > 0)) {
145 $error++;
146 }
147
148 if (!$error) {
149 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
150 } else {
151 setEventMessages($langs->trans("Error"), null, 'mesgs');
152 }
153}
154
155if ($action == 'setenablesubsidiarylist') {
156 $setenablesubsidiarylist = GETPOSTINT('value');
157 $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
158 if (!($res > 0)) {
159 $error++;
160 }
161
162 if (!$error) {
163 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
164 } else {
165 setEventMessages($langs->trans("Error"), null, 'mesgs');
166 }
167}
168
169if ($action == 'setdisablebindingonsales') {
170 $setdisablebindingonsales = GETPOSTINT('value');
171 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
172 if (!($res > 0)) {
173 $error++;
174 }
175
176 if (!$error) {
177 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
178 } else {
179 setEventMessages($langs->trans("Error"), null, 'mesgs');
180 }
181}
182
183if ($action == 'setdisablebindingonpurchases') {
184 $setdisablebindingonpurchases = GETPOSTINT('value');
185 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
186 if (!($res > 0)) {
187 $error++;
188 }
189
190 if (!$error) {
191 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
192 } else {
193 setEventMessages($langs->trans("Error"), null, 'mesgs');
194 }
195}
196
197if ($action == 'setdisablebindingonexpensereports') {
198 $setdisablebindingonexpensereports = GETPOSTINT('value');
199 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
200 if (!($res > 0)) {
201 $error++;
202 }
203
204 if (!$error) {
205 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
206 } else {
207 setEventMessages($langs->trans("Error"), null, 'mesgs');
208 }
209}
210
211if ($action == 'setenablelettering') {
212 $setenablelettering = GETPOSTINT('value');
213 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
214 if (!($res > 0)) {
215 $error++;
216 }
217
218 if (!$error) {
219 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
220 } else {
221 setEventMessages($langs->trans("Error"), null, 'mesgs');
222 }
223}
224
225if ($action == 'setenableautolettering') {
226 $setenableautolettering = GETPOSTINT('value');
227 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
228 if (!($res > 0)) {
229 $error++;
230 }
231
232 if (!$error) {
233 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
234 } else {
235 setEventMessages($langs->trans("Error"), null, 'mesgs');
236 }
237}
238
239if ($action == 'setenablevatreversecharge') {
240 $setenablevatreversecharge = GETPOSTINT('value');
241 $res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
242 if (!($res > 0)) {
243 $error++;
244 }
245
246 if (!$error) {
247 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
248 } else {
249 setEventMessages($langs->trans("Error"), null, 'mesgs');
250 }
251}
252
253
254/*
255 * View
256 */
257
258$form = new Form($db);
259
260$title = $langs->trans('ConfigAccountingExpert');
261$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
262llxHeader('', $title, $help_url);
263
264
265$linkback = '';
266//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
267print load_fiche_titre($title, $linkback, 'accountancy');
268
269print '<br>';
270
271// Show message if accountancy hidden options are activated to help to resolve some problems
272if (!$user->admin) {
273 if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
274 print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
275 }
276 if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
277 print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
278 }
279 if (getDolGlobalString('ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY')) {
280 print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
281 }
282 if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
283 print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
284 }
285 if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
286 print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
287 }
288}
289
290print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
291print '<input type="hidden" name="token" value="'.newToken().'">';
292print '<input type="hidden" name="action" value="update">';
293
294// Params
295print '<div class="div-table-responsive-no-min">';
296print '<table class="noborder centpercent">';
297print '<tr class="liste_titre">';
298print '<td colspan="2">'.$langs->trans('Options').'</td>';
299print "</tr>\n";
300
301// TO DO Mutualize code for yes/no constants
302
303/* Set this option as a hidden option but keep it for some needs.
304print '<tr>';
305print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
306if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL')) {
307 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=0">';
308 print img_picto($langs->trans("Activated"), 'switch_on');
309 print '</a></td>';
310} else {
311 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=1">';
312 print img_picto($langs->trans("Disabled"), 'switch_off');
313 print '</a></td>';
314}
315print '</tr>';
316*/
317
318print '<tr class="oddeven">';
319print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
320if (getDolGlobalString('BANK_DISABLE_DIRECT_INPUT')) {
321 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=0">';
322 print img_picto($langs->trans("Activated"), 'switch_on');
323 print '</a></td>';
324} else {
325 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
326 print img_picto($langs->trans("Disabled"), 'switch_off');
327 print '</a></td>';
328}
329print '</tr>';
330
331print '<tr class="oddeven">';
332print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
333print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';
334print '</td>';
335
336if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
337 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
338 print img_picto($langs->trans("Activated").' - '.$langs->trans("NotRecommended"), 'switch_on', 'class="warning"');
339 print '</a></td>';
340} else {
341 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
342 print img_picto($langs->trans("Disabled"), 'switch_off');
343 print '</a></td>';
344}
345print '</tr>';
346
347print '<tr class="oddeven">';
348print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
349if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) {
350 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=0">';
351 print img_picto($langs->trans("Activated"), 'switch_on');
352 print '</a></td>';
353} else {
354 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=1">';
355 print img_picto($langs->trans("Disabled"), 'switch_off');
356 print '</a></td>';
357}
358print '</tr>';
359
360// Param a user $user->hasRight('accounting', 'chartofaccount') can access
361foreach ($list as $key) {
362 print '<tr class="oddeven value">';
363
364 if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO') && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
365 continue;
366 }
367
368 // Param
369 $label = $langs->trans($key);
370 print '<td>'.$label.'</td>';
371 // Value
372 print '<td class="right">';
373 print '<input type="number" class="maxwidth50 right" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
374
375 print '</td>';
376 print '</tr>';
377}
378
379print '</table>';
380print '</div>';
381
382print '<br>';
383
384// Binding params
385print '<div class="div-table-responsive-no-min">';
386print '<table class="noborder centpercent">';
387print '<tr class="liste_titre">';
388print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
389print "</tr>\n";
390
391// Param a user $user->hasRight('accounting', 'chartofaccount') can access
392foreach ($list_binding as $key) {
393 print '<tr class="oddeven value">';
394
395 // Param
396 $label = $langs->trans($key);
397 print '<td>'.$label.'</td>';
398 // Value
399 print '<td class="right minwidth75imp parentonrightofpage">';
400 if ($key == 'ACCOUNTING_DATE_START_BINDING') {
401 print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
402 } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
403 $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
404 print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width200');
405 } else {
406 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
407 }
408
409 print '</td>';
410 print '</tr>';
411}
412
413print '<tr class="oddeven">';
414print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
415if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
416 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
417 print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
418 print '</a></td>';
419} else {
420 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&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_DISABLE_BINDING_ON_PURCHASES").'</td>';
428if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) {
429 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
430 print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
431 print '</a></td>';
432} else {
433 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
434 print img_picto($langs->trans("Disabled"), 'switch_off');
435 print '</a></td>';
436}
437print '</tr>';
438
439print '<tr class="oddeven">';
440print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
441if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
442 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
443 print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
444 print '</a></td>';
445} else {
446 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';
447 print img_picto($langs->trans("Disabled"), 'switch_off');
448 print '</a></td>';
449}
450print '</tr>';
451
452if (!getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
453 print '<tr class="oddeven">';
454 print '<td>'.$langs->trans("ACCOUNTANCY_ER_DATE_RECORD").'</td>';
455 if (getDolGlobalInt('ACCOUNTANCY_ER_DATE_RECORD')) {
456 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_ER_DATE_RECORD&value=0">';
457 print img_picto($langs->trans("Activated"), 'switch_on');
458 print '</a></td>';
459 } else {
460 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_ER_DATE_RECORD&value=1">';
461 print img_picto($langs->trans("Disabled"), 'switch_off');
462 print '</a></td>';
463 }
464 print '</tr>';
465}
466
467print '<tr class="oddeven">';
468print '<td>'.$langs->trans("ACCOUNTING_BANK_CONCILIATED").'</td>';
469if (getDolGlobalInt('ACCOUNTING_BANK_CONCILIATED') == 2) {
470 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_BANK_CONCILIATED&value=1">';
471 print img_picto($langs->trans("Activated"), 'switch_on');
472 print '</a></td>';
473} else {
474 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_BANK_CONCILIATED&value=2">';
475 print img_picto($langs->trans("Disabled"), 'switch_off');
476 print '</a></td>';
477}
478print '</tr>';
479
480print '</table>';
481print '</div>';
482
483
484
485// Show advanced options
486print '<br>';
487
488
489// Advanced params
490print '<div class="div-table-responsive-no-min">';
491print '<table class="noborder centpercent">';
492print '<tr class="liste_titre">';
493print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
494print "</tr>\n";
495
496print '<tr class="oddeven">';
497print '<td>';
498print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
499if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
500 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
501 print img_picto($langs->trans("Activated"), 'switch_on');
502 print '</a></td>';
503} else {
504 print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
505 print img_picto($langs->trans("Disabled"), 'switch_off');
506 print '</a></td>';
507}
508print '</tr>';
509
510if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
511 // Number of letters for lettering (3 by default (AAA), min 2 (AA))
512 print '<tr class="oddeven">';
513 print '<td>';
514 print $form->textwithpicto($langs->trans("ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans("ACCOUNTING_LETTERING_NBLETTERS_DESC")) . '</td>';
515 print '<td class="right">';
516
517 if (empty($letter)) {
518 if (getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS')) {
519 $nbletter = getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS');
520 } else {
521 $nbletter = 3;
522 }
523 }
524
525 print '<input class="flat right" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="' . $nbletter . '" type="number" step="1" min="2" max="3" >' . "\n";
526 print '</tr>';
527
528 // Auto Lettering when transfer in accountancy is realized
529 print '<tr class="oddeven">';
530 print '<td>';
531 print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
532 if (getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
533 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
534 print img_picto($langs->trans("Activated"), 'switch_on');
535 print '</a></td>';
536 } else {
537 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">';
538 print img_picto($langs->trans("Disabled"), 'switch_off');
539 print '</a></td>';
540 }
541 print '</tr>';
542}
543
544print '<tr class="oddeven">';
545print '<td>';
546print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
547if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
548 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
549 print img_picto($langs->trans("Activated"), 'switch_on');
550 print '</a></td>';
551} else {
552 print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
553 print img_picto($langs->trans("Disabled"), 'switch_off');
554 print '</a></td>';
555}
556print '</tr>';
557
558print '</table>';
559print '</div>';
560
561
562print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Save').'"></div>';
563
564print '</form>';
565
566// End of page
567llxFooter();
568$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:70
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.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.