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