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';
40$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"other"));
43if (!$user->hasRight(
'accounting',
'chartofaccount')) {
47$action =
GETPOST(
'action',
'aZ09');
49$nbletter =
GETPOSTINT(
'ACCOUNTING_LETTERING_NBLETTERS');
53 'ACCOUNTING_LENGTH_GACCOUNT',
54 'ACCOUNTING_LENGTH_AACCOUNT',
58 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER',
59 'ACCOUNTING_DATE_START_BINDING',
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);
72 $res =
dolibarr_set_const($db, $constname, $constvalue,
'yesno', 0,
'', $conf->entity);
84if ($action ==
'update') {
88 foreach ($list as $constname) {
89 $constvalue =
GETPOST($constname,
'alpha');
90 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
99 foreach ($list_binding as $constname) {
100 $constvalue =
GETPOST($constname,
'alpha');
102 if ($constname ==
'ACCOUNTING_DATE_START_BINDING') {
106 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
112 if (GETPOSTISSET(
'ACCOUNTING_LETTERING_NBLETTERS')) {
113 if (!
dolibarr_set_const($db,
'ACCOUNTING_LETTERING_NBLETTERS',
GETPOST(
'ACCOUNTING_LETTERING_NBLETTERS'),
'chaine', 0,
'', $conf->entity)) {
128if ($action ==
'setmanagezero') {
130 $res =
dolibarr_set_const($db,
"ACCOUNTING_MANAGE_ZERO", $setmanagezero,
'yesno', 0,
'', $conf->entity);
142if ($action ==
'setenabledraftexport') {
144 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport,
'yesno', 0,
'', $conf->entity);
156if ($action ==
'setenablesubsidiarylist') {
157 $setenablesubsidiarylist =
GETPOSTINT(
'value');
158 $res =
dolibarr_set_const($db,
"ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist,
'yesno', 0,
'', $conf->entity);
170if ($action ==
'setdisablebindingonsales') {
171 $setdisablebindingonsales =
GETPOSTINT(
'value');
172 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales,
'yesno', 0,
'', $conf->entity);
184if ($action ==
'setdisablebindingonpurchases') {
185 $setdisablebindingonpurchases =
GETPOSTINT(
'value');
186 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases,
'yesno', 0,
'', $conf->entity);
198if ($action ==
'setdisablebindingonexpensereports') {
199 $setdisablebindingonexpensereports =
GETPOSTINT(
'value');
200 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports,
'yesno', 0,
'', $conf->entity);
212if ($action ==
'setenablelettering') {
214 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_LETTERING", $setenablelettering,
'yesno', 0,
'', $conf->entity);
226if ($action ==
'setenableautolettering') {
227 $setenableautolettering =
GETPOSTINT(
'value');
228 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering,
'yesno', 0,
'', $conf->entity);
240if ($action ==
'setenablevatreversecharge') {
241 $setenablevatreversecharge =
GETPOSTINT(
'value');
242 $res =
dolibarr_set_const($db,
"ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge,
'yesno', 0,
'', $conf->entity);
259$form =
new Form($db);
261$title = $langs->trans(
'ConfigAccountingExpert');
262$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
263llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_index');
275 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") .
'</div>';
278 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") .
'</div>';
281 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") .
'</div>';
284 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"MAIN_COMPANY_PERENTITY_SHARED") .
'</div>';
287 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"MAIN_PRODUCT_PERENTITY_SHARED") .
'</div>';
291print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
292print
'<input type="hidden" name="token" value="'.newToken().
'">';
293print
'<input type="hidden" name="action" value="update">';
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>';
319print
'<tr class="oddeven">';
320print
'<td>'.$langs->trans(
"BANK_DISABLE_DIRECT_INPUT").
'</td>';
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');
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');
332print
'<tr class="oddeven">';
333print
'<td>'.$langs->trans(
"ACCOUNTANCY_COMBO_FOR_AUX");
334print
' - <span class="opacitymedium">'.$langs->trans(
"NotRecommended").
'</span>';
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"');
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');
348print
'<tr class="oddeven">';
349print
'<td>'.$langs->trans(
"ACCOUNTING_MANAGE_ZERO").
'</td>';
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');
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');
362foreach ($list as $key) {
363 print
'<tr class="oddeven value">';
365 if (
getDolGlobalInt(
'ACCOUNTING_MANAGE_ZERO') && ($key ==
'ACCOUNTING_LENGTH_GACCOUNT' || $key ==
'ACCOUNTING_LENGTH_AACCOUNT')) {
370 $label = $langs->trans($key);
371 print
'<td>'.$label.
'</td>';
373 print
'<td class="right">';
374 print
'<input type="number" class="maxwidth50 right" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
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>';
393foreach ($list_binding as $key) {
394 print
'<tr class="oddeven value">';
397 $label = $langs->trans($key);
398 print
'<td>'.$label.
'</td>';
400 print
'<td class="right minwidth75imp parentonrightofpage">';
401 if ($key ==
'ACCOUNTING_DATE_START_BINDING') {
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');
407 print
'<input type="text" class="maxwidth100" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
414print
'<tr class="oddeven">';
415print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_SALES").
'</td>';
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');
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');
427print
'<tr class="oddeven">';
428print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").
'</td>';
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');
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');
440print
'<tr class="oddeven">';
441print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").
'</td>';
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');
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');
454 print
'<tr class="oddeven">';
455 print
'<td>'.$langs->trans(
"ACCOUNTANCY_ER_DATE_RECORD").
'</td>';
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');
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');
468print
'<tr class="oddeven">';
469print
'<td>'.$langs->trans(
"ACCOUNTING_BANK_CONCILIATED").
'</td>';
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');
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');
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>';
497print
'<tr class="oddeven">';
499print $form->textwithpicto($langs->trans(
"ACCOUNTING_ENABLE_LETTERING"), $langs->trans(
"ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv(
"NumMvts")).
'<br>'.$langs->trans(
"EnablingThisFeatureIsNotNecessary")).
'</td>';
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');
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');
513 print
'<tr class="oddeven">';
515 print $form->textwithpicto($langs->trans(
"ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans(
"ACCOUNTING_LETTERING_NBLETTERS_DESC")) .
'</td>';
516 print
'<td class="right">';
518 if (empty($letter)) {
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";
530 print
'<tr class="oddeven">';
532 print $form->textwithpicto($langs->trans(
"ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans(
"ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) .
'</td>';
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');
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');
545print
'<tr class="oddeven">';
547print $form->textwithpicto($langs->trans(
"ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans(
"ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities(
"MenuDefaultAccounts"))).
'</td>';
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');
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');
563print
'<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans(
'Save').
'"></div>';
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.
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.