35require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
52$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"other"));
55if (!$user->hasRight(
'accounting',
'chartofaccount')) {
59$action =
GETPOST(
'action',
'aZ09');
64$nbletter =
GETPOSTINT(
'ACCOUNTING_LETTERING_NBLETTERS');
70$item = $formSetup->newItem(
'BANK_DISABLE_DIRECT_INPUT')->setAsYesNo();
71$item->fieldParams[
'tdOutputFieldClass'] =
'right';
75 (
string) 0 => $langs->trans(
"No").
' - <span class="opacitymedium small">'.$langs->trans(
"FreeInput").
'</span>',
76 (
string) 1 => $langs->trans(
"Yes").
' - <span class="opacitymedium small">'.$langs->trans(
"DropDownList").
'</span>',
77 (
string) 2 => $langs->trans(
"Yes").
' - <span class="opacitymedium small">'.$langs->trans(
"NumberOfKeyToSearch", 1).
'</span>',
78 (
string) 3 => $langs->trans(
"Yes").
' - <span class="opacitymedium small">'.$langs->trans(
"NumberOfKeyToSearch", 2).
'</span>',
79 (
string) 4 => $langs->trans(
"Yes").
' - <span class="opacitymedium small">'.$langs->trans(
"NumberOfKeyToSearch", 3).
'</span>',
81$item = $formSetup->newItem(
'ACCOUNTANCY_AUXACCOUNT_USE_SEARCH_TO_SELECT');
82$item->setAsSelect($arrval);
83$item->helpText = $langs->trans(
'UseSearchToSelectAuxAccountTooltip');
84$item->cssClass =
'minwidth300 maxwidth400';
85$item->fieldParams[
'tdOutputFieldClass'] =
'right';
87$item = $formSetup->newItem(
'ACCOUNTING_MANAGE_ZERO')->setAsYesNo();
88$item->helpText = $langs->trans(
'ACCOUNTING_MANAGE_ZERO2');
89$item->fieldParams[
'helpText'] =
'noclick';
90$item->fieldParams[
'forcereload'] = 1;
91$item->fieldParams[
'tdOutputFieldClass'] =
'right';
95 $item = $formSetup->newItem(
'ACCOUNTING_LENGTH_GACCOUNT')->setAsString();
96 $item->fieldAttr[
'type'] =
'number';
97 $item->fieldAttr[
'class'] =
'maxwidth50';
98 $item->fieldParams[
'tdOutputFieldClass'] =
'right';
100 $item = $formSetup->newItem(
'ACCOUNTING_LENGTH_AACCOUNT')->setAsString();
101 $item->fieldAttr[
'type'] =
'number';
102 $item->fieldAttr[
'class'] =
'maxwidth50';
103 $item->fieldParams[
'tdOutputFieldClass'] =
'right';
108 'ACCOUNTING_LENGTH_GACCOUNT',
109 'ACCOUNTING_LENGTH_AACCOUNT',
112$list_binding = array(
113 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER',
114 'ACCOUNTING_DATE_START_BINDING',
115 'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER'
120 'ACCOUNTING_EXPORT_PREFIX_SPEC',
124$configuration = $accountancyexport->getTypeConfig();
126$listparam = $configuration[
'param'];
127$listformat = $configuration[
'format'];
128$listcr = $configuration[
'cr'];
130$model_option = array(
132 'label' =>
'ACCOUNTING_EXPORT_FORMAT',
133 'param' => $listformat,
136 'label' =>
'ACCOUNTING_EXPORT_SEPARATORCSV',
140 'label' =>
'ACCOUNTING_EXPORT_ENDLINE',
144 'label' =>
'ACCOUNTING_EXPORT_DATE',
158include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
160if (in_array($action, array(
'setACCOUNTANCY_ER_DATE_RECORD',
'setACCOUNTING_BANK_CONCILIATED'))) {
161 $constname = preg_replace(
'/^set/',
'', $action);
169 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
171 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
175if ($action ==
'updatemode') {
178 $accounting_modes = array(
183 $accounting_mode =
GETPOST(
'accounting_mode',
'alpha');
185 if (in_array($accounting_mode, $accounting_modes)) {
187 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
196if ($action ==
'update') {
199 foreach ($list as $constname) {
200 $constvalue =
GETPOST($constname,
'alpha');
208 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
210 setEventMessages($langs->trans(
"Error"),
null,
'errors');
214if ($action ==
'update_binding') {
217 foreach ($list_binding as $constname) {
218 $constvalue =
GETPOST($constname,
'alpha');
220 if ($constname ==
'ACCOUNTING_DATE_START_BINDING') {
230 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
232 setEventMessages($langs->trans(
"Error"),
null,
'errors');
236if ($action ==
'update_advanced') {
246 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
248 setEventMessages($langs->trans(
"Error"),
null,
'errors');
252if ($action ==
'update_export') {
256 $modelcsv =
GETPOSTINT(
'ACCOUNTING_EXPORT_MODELCSV');
259 $configuration = $accountancyexport->getTypeConfig();
260 $listparam = $configuration[
'param'];
262 if (!empty($modelcsv)) {
273 foreach ($main_option as $constname) {
274 $constvalue =
GETPOST($constname,
'alpha');
281 foreach ($listparam[$modelcsv] as $key => $value) {
284 if (strpos($constante,
'ACCOUNTING') !==
false) {
285 $constvalue =
GETPOST($key,
'alpha');
293 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
295 setEventMessages($langs->trans(
"Error"),
null,
'errors');
299if ($action ==
'setenabledraftexport') {
301 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport,
'yesno', 0,
'',
$conf->entity);
307 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
309 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
313if ($action ==
'setdisablebindingonsales') {
314 $setdisablebindingonsales =
GETPOSTINT(
'value');
315 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales,
'yesno', 0,
'',
$conf->entity);
321 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
323 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
327if ($action ==
'setdisablebindingonpurchases') {
328 $setdisablebindingonpurchases =
GETPOSTINT(
'value');
329 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases,
'yesno', 0,
'',
$conf->entity);
335 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
337 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
341if ($action ==
'setdisablebindingonexpensereports') {
342 $setdisablebindingonexpensereports =
GETPOSTINT(
'value');
343 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports,
'yesno', 0,
'',
$conf->entity);
349 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
351 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
355if ($action ==
'setdisabletransferonassets') {
356 $setdisabletransferonassets =
GETPOSTINT(
'value');
357 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS", $setdisabletransferonassets,
'yesno', 0,
'',
$conf->entity);
363 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
365 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
369if ($action ==
'setdisabletransferondiscounts') {
370 $setdisabletransferondiscounts =
GETPOSTINT(
'value');
371 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS", $setdisabletransferondiscounts,
'yesno', 0,
'',
$conf->entity);
377 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
379 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
383if ($action ==
'setenablelettering') {
385 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_LETTERING", $setenablelettering,
'yesno', 0,
'',
$conf->entity);
391 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
393 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
397if ($action ==
'setenableautolettering') {
398 $setenableautolettering =
GETPOSTINT(
'value');
399 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering,
'yesno', 0,
'',
$conf->entity);
405 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
407 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
411if ($action ==
'setenablevatreversecharge') {
412 $setenablevatreversecharge =
GETPOSTINT(
'value');
413 $res =
dolibarr_set_const($db,
"ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge,
'yesno', 0,
'',
$conf->entity);
419 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
421 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
425if ($action ==
'setenabletabonthirdparty') {
426 $setenabletabonthirdparty =
GETPOSTINT(
'value');
427 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_TABONTHIRDPARTY", $setenabletabonthirdparty,
'yesno', 0,
'',
$conf->entity);
433 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
435 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
439if ($action ==
'setenabledissociatecashsales') {
440 $setenabledissociatecashsales =
GETPOSTINT(
'value');
441 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISSOCIATE_CASH_SALES", $setenabledissociatecashsales,
'yesno', 0,
'',
$conf->entity);
447 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
449 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
453if ($action ==
'setexportenablelettering') {
454 $setexportenablelettering =
GETPOSTINT(
'value');
455 $res =
dolibarr_set_const($db,
"ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING", $setexportenablelettering,
'yesno', 0,
'',
$conf->entity);
461 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
463 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
467if ($action ==
'setexportenableexportdate') {
468 $setexportenableexportdate =
GETPOSTINT(
'value');
469 $res =
dolibarr_set_const($db,
"ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE", $setexportenableexportdate,
'yesno', 0,
'',
$conf->entity);
475 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
477 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
481if ($action ==
'setexportenablevalidationdate') {
482 $setexportenablevalidationdate =
GETPOSTINT(
'value');
483 $res =
dolibarr_set_const($db,
"ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE", $setexportenablevalidationdate,
'yesno', 0,
'',
$conf->entity);
489 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
491 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
495if ($action ==
'setexportenablefull') {
497 $res =
dolibarr_set_const($db,
"ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL", $setexportenablefull,
'yesno', 0,
'',
$conf->entity);
503 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
505 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
509if ($action ==
'updateMask') {
510 $maskconstbookkeeping =
GETPOST(
'maskconstbookkeeping',
'aZ09');
511 $maskbookkeeping =
GETPOST(
'maskbookkeeping',
'alpha');
515 if ($maskconstbookkeeping && preg_match(
'/_MASK$/', $maskconstbookkeeping)) {
524 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
526 setEventMessages($langs->trans(
"Error"),
null,
'errors');
530if ($action ==
'setmod') {
531 $value =
GETPOST(
'value',
'alpha');
539$form =
new Form($db);
541$title = $langs->trans(
'ConfigAccountingExpert');
542$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
543llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_index');
553 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") .
'</div>';
556 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") .
'</div>';
559 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") .
'</div>';
562 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"MAIN_COMPANY_PERENTITY_SHARED") .
'</div>';
565 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"MAIN_PRODUCT_PERENTITY_SHARED") .
'</div>';
572print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
573print
'<input type="hidden" name="token" value="'.newToken().
'">';
574print
'<input type="hidden" name="action" value="updatemode">';
576print
'<table class="noborder centpercent">';
578print
'<tr class="liste_titre">';
579print
'<td colspan="2">'.$langs->trans(
'OptionMode').
'</td>';
581print
'<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_1" name="accounting_mode" value="CREANCES-DETTES"'.($accounting_mode !=
'RECETTES-DEPENSES' ?
' checked' :
'').
'><label for="accounting_mode_1"> '.$langs->trans(
'OptionModeVirtual').
'</label> ('.$langs->trans(
'Default').
')</td>';
582print
'<td><span class="opacitymedium">'.nl2br($langs->trans(
'ACCOUNTING_USE_NON_TREASURY_Desc')).
'</span>';
584print
'<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_2" name="accounting_mode" value="RECETTES-DEPENSES"'.($accounting_mode ==
'RECETTES-DEPENSES' ?
' checked' :
'').
'><label for="accounting_mode_2"> '.$langs->trans(
'OptionModeTrue').
'</label></td>';
585print
'<td><span class="opacitymedium">'.nl2br($langs->trans(
'ACCOUNTING_USE_TREASURY_Desc')).
"</span>";
590print
'<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans(
'Save').
'"></div>';
596print $formSetup->generateOutput(
true);
601print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
602print
'<input type="hidden" name="token" value="'.newToken().
'">';
603print
'<input type="hidden" name="action" value="update_binding">';
604print
'<input type="hidden" name="page_y" value="">';
607print
'<div class="div-table-responsive-no-min">';
608print
'<table class="noborder centpercent">';
609print
'<tr class="liste_titre">';
610print
'<td colspan="2">'.$langs->trans(
'BindingOptions').
'</td>';
614foreach ($list_binding as $key) {
615 print
'<tr class="oddeven value">';
618 $label = $langs->trans($key);
619 print
'<td>'.$label.
'</td>';
621 print
'<td class="right minwidth75imp parentonrightofpage">';
622 if ($key ==
'ACCOUNTING_DATE_START_BINDING') {
624 } elseif ($key ==
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
625 $array = array(0 => $langs->trans(
"PreviousMonth"), 1 => $langs->trans(
"CurrentMonth"), 2 => $langs->trans(
"Fiscalyear"));
626 print $form->selectarray($key, $array,
getDolGlobalInt(
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0,
'', 0, 0, 0,
'',
'onrightofpage width200');
627 } elseif ($key ==
'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') {
629 0 => $langs->trans(
"ThirdPartyName") .
' - ' . $langs->trans(
"NumPiece") .
' - ' . $langs->trans(
"LabelAccount"),
630 1 => $langs->trans(
"ThirdPartyName") .
' - ' . $langs->trans(
"NumPiece"),
631 2 => $langs->trans(
"ThirdPartyName")
633 print $form->selectarray($key, $array,
getDolGlobalInt(
'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER', 0), 0, 0, 0,
'', 0, 0, 0,
'',
'onrightofpage width300');
635 print
'<input type="text" class="maxwidth100" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
642print
'<tr class="oddeven">';
643print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_SALES").
'</td>';
645 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonsales&value=0">';
646 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
649 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonsales&value=1">';
650 print img_picto($langs->trans(
"Disabled"),
'switch_off');
655print
'<tr class="oddeven">';
656print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").
'</td>';
658 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonpurchases&value=0">';
659 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
662 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonpurchases&value=1">';
663 print img_picto($langs->trans(
"Disabled"),
'switch_off');
668print
'<tr class="oddeven">';
669print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").
'</td>';
671 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonexpensereports&value=0">';
672 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
675 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonexpensereports&value=1">';
676 print img_picto($langs->trans(
"Disabled"),
'switch_off');
681print
'<tr class="oddeven">';
682print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS").
'</td>';
684 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisabletransferonassets&value=0">';
685 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
688 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisabletransferonassets&value=1">';
689 print img_picto($langs->trans(
"Disabled"),
'switch_off');
694print
'<tr class="oddeven">';
695print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS").
'</td>';
697 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisabletransferondiscounts&value=0">';
698 print img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'warning');
701 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisabletransferondiscounts&value=1">';
702 print img_picto($langs->trans(
"Disabled"),
'switch_off');
708 print
'<tr class="oddeven">';
709 print
'<td>'.$langs->trans(
"ACCOUNTANCY_ER_DATE_RECORD").
'</td>';
711 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTANCY_ER_DATE_RECORD&value=0">';
712 print img_picto($langs->trans(
"Activated"),
'switch_on');
715 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTANCY_ER_DATE_RECORD&value=1">';
716 print img_picto($langs->trans(
"Disabled"),
'switch_off');
722print
'<tr class="oddeven">';
723print
'<td>'.$langs->trans(
"ACCOUNTING_BANK_CONCILIATED").
'</td>';
725 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_BANK_CONCILIATED&value=1">';
726 print img_picto($langs->trans(
"Activated"),
'switch_on');
729 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_BANK_CONCILIATED&value=2">';
730 print img_picto($langs->trans(
"Disabled"),
'switch_off');
738print
'<div class="center"><input type="submit" class="button button-edit reposition" name="button" value="'.dol_escape_htmltag($langs->trans(
'Save')).
'"></div>';
745$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
747print
'<div class="div-table-responsive-no-min">';
748print
'<table class="noborder centpercent">';
749print
'<tr class="liste_titre">';
750print
'<td colspan="2">'.$langs->trans(
"BookkeepingNumberingModules").
'</td>';
751print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
752print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
753print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
758$arrayofmodules = array();
760foreach ($dirmodels as $reldir) {
764 $handle = opendir($dir);
765 if (is_resource($handle)) {
766 while (($file = readdir($handle)) !==
false) {
767 if (strpos($file,
'mod_bookkeeping_') === 0 &&
dol_substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
770 require_once $dir.$file.
'.php';
775 '@phan-var-force ModeleNumRefBookkeeping $module';
787foreach ($arrayofmodules as
$module) {
788 $file =
'mod_bookkeeping_'.strtolower(
$module->getName($langs));
799 print
'<tr class="oddeven"><td class="width100">'.$module->name.
"</td><td>\n";
804 print
'<td class="nowrap">';
806 if (preg_match(
'/^Error/', $tmp)) {
807 $langs->load(
"errors");
808 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
809 } elseif ($tmp ==
'NotConfigured') {
810 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
816 print
'<td class="center">';
818 print img_picto($langs->trans(
"Activated"),
'switch_on');
820 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($file).
'">';
821 print img_picto($langs->trans(
"Disabled"),
'switch_off');
827 $bookkeeping->initAsSpecimen();
830 $htmltooltip =
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
832 $nextval =
$module->getNextValue($bookkeeping);
833 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
834 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
836 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
837 $nextval = $langs->trans($nextval);
839 $htmltooltip .= $nextval.
'<br>';
841 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
845 print
'<td class="center">';
846 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
860print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
861print
'<input type="hidden" name="token" value="'.newToken().
'">';
862print
'<input type="hidden" name="action" value="update_advanced">';
863print
'<input type="hidden" name="page_y" value="">';
865print
'<div class="div-table-responsive-no-min">';
866print
'<table class="noborder centpercent">';
867print
'<tr class="liste_titre">';
868print
'<td colspan="2">' . $langs->trans(
'OptionsAdvanced') .
'</td>';
871print
'<tr class="oddeven">';
873print $form->textwithpicto($langs->trans(
"ACCOUNTING_ENABLE_LETTERING"), $langs->trans(
"ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv(
"NumMvts")).
'<br>'.$langs->trans(
"EnablingThisFeatureIsNotNecessary")).
'</td>';
875 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setenablelettering&value=0">';
876 print img_picto($langs->trans(
"Activated"),
'switch_on');
879 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setenablelettering&value=1">';
880 print img_picto($langs->trans(
"Disabled"),
'switch_off');
887 print
'<tr class="oddeven">';
889 print $form->textwithpicto($langs->trans(
"ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans(
"ACCOUNTING_LETTERING_NBLETTERS_DESC")) .
'</td>';
890 print
'<td class="right">';
892 if (empty($letter)) {
900 print
'<input class="flat right" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="' . $nbletter .
'" type="number" step="1" min="2" max="3" >' .
"\n";
904 print
'<tr class="oddeven">';
906 print $form->textwithpicto($langs->trans(
"ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans(
"ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) .
'</td>';
908 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenableautolettering&value=0">';
909 print img_picto($langs->trans(
"Activated"),
'switch_on');
912 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenableautolettering&value=1">';
913 print img_picto($langs->trans(
"Disabled"),
'switch_off');
919print
'<tr class="oddeven">';
921print $form->textwithpicto($langs->trans(
"ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans(
"ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities(
"MenuDefaultAccounts"))).
'</td>';
923 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenablevatreversecharge&value=0">';
924 print img_picto($langs->trans(
"Activated"),
'switch_on');
927 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenablevatreversecharge&value=1">';
928 print img_picto($langs->trans(
"Disabled"),
'switch_off');
933print
'<tr class="oddeven">';
935print $form->textwithpicto($langs->trans(
"ACCOUNTING_ENABLE_TABONTHIRDPARTY"), $langs->trans(
"ACCOUNTING_ENABLE_TABONTHIRDPARTY_DESC")).
'</td>';
937 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenabletabonthirdparty&value=0">';
938 print img_picto($langs->trans(
"Activated"),
'switch_on');
941 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenabletabonthirdparty&value=1">';
942 print img_picto($langs->trans(
"Disabled"),
'switch_off');
947print
'<tr class="oddeven">';
949print $form->textwithpicto($langs->trans(
"AccountingDissociateCashSales"), $langs->trans(
"AccountingDissociateCashSalesDesc")).
'</td>';
951 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenabledissociatecashsales&value=0">';
952 print img_picto($langs->trans(
"Activated"),
'switch_on');
955 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setenabledissociatecashsales&value=1">';
956 print img_picto($langs->trans(
"Disabled"),
'switch_off');
965print
'<div class="center"><input type="submit" class="button button-edit reposition" name="button" value="'.$langs->trans(
'Save').
'"></div>';
973print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
974print
'<input type="hidden" name="token" value="'.newToken().
'">';
975print
'<input type="hidden" name="action" value="update_export">';
976print
'<input type="hidden" name="page_y" value="">';
978print
"\n".
'<script type="text/javascript">'.
"\n";
979print
'jQuery(document).ready(function () {'.
"\n";
980print
' function initfields()'.
"\n";
982foreach ($listparam as $key => $param) {
983 print
' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.
'")'.
"\n";
985 print
' //console.log("'.$param[
'label'].
'");'.
"\n";
986 if (empty($param[
'ACCOUNTING_EXPORT_FORMAT'])) {
987 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.getDolGlobalString(
'ACCOUNTING_EXPORT_FORMAT').
'");'.
"\n";
988 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'.
"\n";
990 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[
'ACCOUNTING_EXPORT_FORMAT'].
'");'.
"\n";
991 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'.
"\n";
993 if (empty($param[
'ACCOUNTING_EXPORT_SEPARATORCSV'])) {
994 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'.
"\n";
995 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'.
"\n";
997 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.getDolGlobalString(
'ACCOUNTING_EXPORT_SEPARATORCSV').
'");'.
"\n";
998 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'.
"\n";
1000 if (empty($param[
'ACCOUNTING_EXPORT_ENDLINE'])) {
1001 print
' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'.
"\n";
1003 print
' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'.
"\n";
1005 if (empty($param[
'ACCOUNTING_EXPORT_DATE'])) {
1006 print
' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'.
"\n";
1007 print
' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'.
"\n";
1009 print
' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.getDolGlobalString(
'ACCOUNTING_EXPORT_DATE').
'");'.
"\n";
1010 print
' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'.
"\n";
1015print
' initfields();'.
"\n";
1016print
' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'.
"\n";
1017print
' initfields();'.
"\n";
1020print
'</script>'.
"\n";
1022print
'<table class="noborder centpercent">';
1023print
'<tr class="liste_titre">';
1024print
'<td colspan="2">'.$langs->trans(
'ExportOptions').
'</td>';
1027$num = count($main_option);
1029 foreach ($main_option as $key) {
1030 print
'<tr class="oddeven value">';
1033 $label = $langs->trans($key);
1034 print
'<td>'.dol_escape_htmltag($label).
'</td>';
1038 print
'<input type="text" size="20" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
1043print
'<tr class="oddeven">';
1044print
'<td>'.$langs->trans(
"Selectmodelcsv").
'</td>';
1045if (!
$conf->use_javascript_ajax) {
1046 print
'<td class="nowrap">';
1047 print $langs->trans(
"NotAvailableWhenAjaxDisabled");
1051 $listofexporttemplates = $accountancyexport->getType(1);
1052 print $form->selectarray(
"ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates,
getDolGlobalString(
'ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1058$num2 = count($model_option);
1060 foreach ($model_option as $key) {
1061 print
'<tr class="oddeven value">';
1064 $label = $key[
'label'];
1065 print
'<td>'.$langs->trans($label).
'</td>';
1069 if (is_array($key[
'param'])) {
1072 print
'<input type="text" size="20" id="'.$label.
'" name="'.$key[
'label'].
'" value="'.
getDolGlobalString($label).
'">';
1079print
'<tr class="oddeven">';
1081print $form->textwithpicto($langs->trans(
"AccountingDefaultNotExportLettering"), $langs->trans(
"AccountingDefaultNotExportLetteringDesc")) .
'</td>';
1083 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenablelettering&value=0">';
1084 print img_picto($langs->trans(
"Activated"),
'switch_on');
1087 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenablelettering&value=1">';
1088 print img_picto($langs->trans(
"Disabled"),
'switch_off');
1093print
'<tr class="oddeven">';
1095print $form->textwithpicto($langs->trans(
"AccountingDefaultNotNotifiedExportDate"), $langs->trans(
"AccountingDefaultNotNotifiedExportDateDesc")) .
'</td>';
1097 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenableexportdate&value=0">';
1098 print img_picto($langs->trans(
"Activated"),
'switch_on');
1101 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenableexportdate&value=1">';
1102 print img_picto($langs->trans(
"Disabled"),
'switch_off');
1107print
'<tr class="oddeven">';
1109print $form->textwithpicto($langs->trans(
"AccountingDefaultNotifiedValidationDate"), $langs->trans(
"AccountingDefaultNotifiedValidationDateDesc")) .
'</td>';
1111 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenablevalidationdate&value=0">';
1112 print img_picto($langs->trans(
"Activated"),
'switch_on');
1115 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenablevalidationdate&value=1">';
1116 print img_picto($langs->trans(
"Disabled"),
'switch_off');
1121print
'<tr class="oddeven">';
1123print $form->textwithpicto($langs->trans(
"AccountingDefaultNotifiedExportFull"), $langs->trans(
"AccountingDefaultNotifiedExportFullDesc")) .
'</td>';
1125 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenablefull&value=0">';
1126 print img_picto($langs->trans(
"Activated"),
'switch_on');
1129 print
'<td class="right"><a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=setexportenablefull&value=1">';
1130 print img_picto($langs->trans(
"Disabled"),
'switch_off');
1137print
'<div class="center"><input type="submit" class="button reposition" value="'.dol_escape_htmltag($langs->trans(
'Save')).
'" name="button"></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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Manage the different format accountancy export.
Class to manage Ledger (General Ledger and Subledger)
if(! $sortfield) if(! $sortorder) $module
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...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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 a Dolibarr global constant string value.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.