dolibarr  19.0.0-dev
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-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
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 // Parameters ACCOUNTING_* and others
49 $list = array(
50  'ACCOUNTING_LENGTH_GACCOUNT',
51  'ACCOUNTING_LENGTH_AACCOUNT',
52 // '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.
53 // 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
54 // 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
55 );
56 
57 $list_binding = array(
58  'ACCOUNTING_DATE_START_BINDING',
59  'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
60 );
61 
62 $error = 0;
63 
64 
65 /*
66  * Actions
67  */
68 
69 if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
70  $constname = preg_replace('/^set/', '', $action);
71  $constvalue = GETPOST('value', 'int');
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 
84 if ($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  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, GETPOST($constname.'month', 'int'), GETPOST($constname.'day', 'int'), GETPOST($constname.'year', 'int'));
103  }
104 
105  if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
106  $error++;
107  }
108  }
109  if ($error) {
110  setEventMessages($langs->trans("Error"), null, 'errors');
111  }
112  }
113 
114  if (!$error) {
115  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
116  }
117 }
118 
119 if ($action == 'setmanagezero') {
120  $setmanagezero = GETPOST('value', 'int');
121  $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
122  if (!($res > 0)) {
123  $error++;
124  }
125 
126  if (!$error) {
127  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
128  } else {
129  setEventMessages($langs->trans("Error"), null, 'mesgs');
130  }
131 }
132 
133 if ($action == 'setdisabledirectinput') {
134  $setdisabledirectinput = GETPOST('value', 'int');
135  $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
136  if (!($res > 0)) {
137  $error++;
138  }
139 
140  if (!$error) {
141  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
142  } else {
143  setEventMessages($langs->trans("Error"), null, 'mesgs');
144  }
145 }
146 
147 if ($action == 'setenabledraftexport') {
148  $setenabledraftexport = GETPOST('value', 'int');
149  $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
150  if (!($res > 0)) {
151  $error++;
152  }
153 
154  if (!$error) {
155  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
156  } else {
157  setEventMessages($langs->trans("Error"), null, 'mesgs');
158  }
159 }
160 
161 if ($action == 'setenablesubsidiarylist') {
162  $setenablesubsidiarylist = GETPOST('value', 'int');
163  $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
164  if (!($res > 0)) {
165  $error++;
166  }
167 
168  if (!$error) {
169  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
170  } else {
171  setEventMessages($langs->trans("Error"), null, 'mesgs');
172  }
173 }
174 
175 if ($action == 'setdisablebindingonsales') {
176  $setdisablebindingonsales = GETPOST('value', 'int');
177  $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
178  if (!($res > 0)) {
179  $error++;
180  }
181 
182  if (!$error) {
183  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
184  } else {
185  setEventMessages($langs->trans("Error"), null, 'mesgs');
186  }
187 }
188 
189 if ($action == 'setdisablebindingonpurchases') {
190  $setdisablebindingonpurchases = GETPOST('value', 'int');
191  $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
192  if (!($res > 0)) {
193  $error++;
194  }
195 
196  if (!$error) {
197  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
198  } else {
199  setEventMessages($langs->trans("Error"), null, 'mesgs');
200  }
201 }
202 
203 if ($action == 'setdisablebindingonexpensereports') {
204  $setdisablebindingonexpensereports = GETPOST('value', 'int');
205  $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
206  if (!($res > 0)) {
207  $error++;
208  }
209 
210  if (!$error) {
211  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
212  } else {
213  setEventMessages($langs->trans("Error"), null, 'mesgs');
214  }
215 }
216 
217 if ($action == 'setenablelettering') {
218  $setenablelettering = GETPOST('value', 'int');
219  $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
220  if (!($res > 0)) {
221  $error++;
222  }
223 
224  if (!$error) {
225  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
226  } else {
227  setEventMessages($langs->trans("Error"), null, 'mesgs');
228  }
229 }
230 
231 if ($action == 'setenableautolettering') {
232  $setenableautolettering = GETPOST('value', 'int');
233  $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
234  if (!($res > 0)) {
235  $error++;
236  }
237 
238  if (!$error) {
239  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
240  } else {
241  setEventMessages($langs->trans("Error"), null, 'mesgs');
242  }
243 }
244 
245 if ($action == 'setenablevatreversecharge') {
246  $setenablevatreversecharge = GETPOST('value', 'int');
247  $res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
248  if (!($res > 0)) {
249  $error++;
250  }
251 
252  if (!$error) {
253  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
254  } else {
255  setEventMessages($langs->trans("Error"), null, 'mesgs');
256  }
257 }
258 
259 /*
260  * View
261  */
262 
263 $form = new Form($db);
264 
265 $title = $langs->trans('ConfigAccountingExpert');
266 llxHeader('', $title);
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 // Show message if accountancy hidden options are activated to help to resolve some problems
273 if (!$user->admin) {
274  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
275  print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
276  }
277  if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
278  print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
279  }
280  if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
281  print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
282  }
283  if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
284  print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
285  }
286  if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
287  print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
288  }
289 }
290 
291 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
292 print '<input type="hidden" name="token" value="'.newToken().'">';
293 print '<input type="hidden" name="action" value="update">';
294 
295 // Params
296 print '<table class="noborder centpercent">';
297 print '<tr class="liste_titre">';
298 print '<td colspan="2">'.$langs->trans('Options').'</td>';
299 print "</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.
304 print '<tr>';
305 print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
306 if (!empty($conf->global->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 }
315 print '</tr>';
316 */
317 
318 print '<tr class="oddeven">';
319 print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
320 if (!empty($conf->global->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 }
329 print '</tr>';
330 
331 print '<tr class="oddeven">';
332 print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
333 print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';
334 print '</td>';
335 
336 if (!empty($conf->global->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"), 'switch_on');
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 }
345 print '</tr>';
346 
347 print '<tr class="oddeven">';
348 print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
349 if (!empty($conf->global->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 }
358 print '</tr>';
359 
360 // Param a user $user->rights->accounting->chartofaccount can access
361 foreach ($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="text" class="maxwidth50 right" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
374 
375  print '</td>';
376  print '</tr>';
377 }
378 print '</table>';
379 print '<br>';
380 
381 // Binding params
382 print '<table class="noborder centpercent">';
383 print '<tr class="liste_titre">';
384 print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
385 print "</tr>\n";
386 
387 // Param a user $user->rights->accounting->chartofaccount can access
388 foreach ($list_binding as $key) {
389  print '<tr class="oddeven value">';
390 
391  // Param
392  $label = $langs->trans($key);
393  print '<td>'.$label.'</td>';
394  // Value
395  print '<td class="right">';
396  if ($key == 'ACCOUNTING_DATE_START_BINDING') {
397  print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
398  } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
399  $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
400  print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
401  } else {
402  print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
403  }
404 
405  print '</td>';
406  print '</tr>';
407 }
408 
409 print '<tr class="oddeven">';
410 print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
411 if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
412  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
413  print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
414  print '</a></td>';
415 } else {
416  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
417  print img_picto($langs->trans("Disabled"), 'switch_off');
418  print '</a></td>';
419 }
420 print '</tr>';
421 
422 print '<tr class="oddeven">';
423 print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
424 if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
425  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
426  print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
427  print '</a></td>';
428 } else {
429  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
430  print img_picto($langs->trans("Disabled"), 'switch_off');
431  print '</a></td>';
432 }
433 print '</tr>';
434 
435 print '<tr class="oddeven">';
436 print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
437 if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
438  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
439  print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
440  print '</a></td>';
441 } else {
442  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';
443  print img_picto($langs->trans("Disabled"), 'switch_off');
444  print '</a></td>';
445 }
446 print '</tr>';
447 
448 print '</table>';
449 print '<br>';
450 
451 
452 // Show advanced options
453 print '<br>';
454 
455 
456 // Advanced params
457 print '<table class="noborder centpercent">';
458 print '<tr class="liste_titre">';
459 print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
460 print "</tr>\n";
461 
462 print '<tr class="oddeven">';
463 print '<td>';
464 print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
465 if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
466  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
467  print img_picto($langs->trans("Activated"), 'switch_on');
468  print '</a></td>';
469 } else {
470  print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
471  print img_picto($langs->trans("Disabled"), 'switch_off');
472  print '</a></td>';
473 }
474 print '</tr>';
475 
476 if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
477  print '<tr class="oddeven">';
478  print '<td>';
479  print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
480  if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
481  print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
482  print img_picto($langs->trans("Activated"), 'switch_on');
483  print '</a></td>';
484  } else {
485  print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">';
486  print img_picto($langs->trans("Disabled"), 'switch_off');
487  print '</a></td>';
488  }
489  print '</tr>';
490 }
491 
492 print '<tr class="oddeven">';
493 print '<td>';
494 print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
495 if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
496  print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
497  print img_picto($langs->trans("Activated"), 'switch_on');
498  print '</a></td>';
499 } else {
500  print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
501  print img_picto($langs->trans("Disabled"), 'switch_off');
502  print '</a></td>';
503 }
504 print '</tr>';
505 
506 print '</table>';
507 
508 
509 print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
510 
511 print '</form>';
512 
513 // End of page
514 llxFooter();
515 $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:638
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
llxFooter()
Footer empty.
Definition: index.php:71
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:63
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.