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