dolibarr 25.0.0-alpha
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3 * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
4 * Copyright (C) 2013-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
5 * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
6 * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
7 * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
8 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
9 * Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
10 * Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
11 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
12 * Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27
34// Load Dolibarr environment
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';
50
51// Load translation files required by the page
52$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
53
54// Security access
55if (!$user->hasRight('accounting', 'chartofaccount')) {
57}
58
59$action = GETPOST('action', 'aZ09');
60if (empty($action)) {
61 $action = 'edit';
62}
63
64$nbletter = GETPOSTINT('ACCOUNTING_LETTERING_NBLETTERS');
65
66// New form setup options
67$formSetup = new FormSetup($db);
68
69// Main options
70$item = $formSetup->newItem('BANK_DISABLE_DIRECT_INPUT')->setAsYesNo();
71$item->fieldParams['tdOutputFieldClass'] = 'right';
72
73// Auxiliary account select mode
74$arrval = array(
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>',
80);
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';
86
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';
92
93
94if (!getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) {
95 $item = $formSetup->newItem('ACCOUNTING_LENGTH_GACCOUNT')->setAsString();
96 $item->fieldAttr['type'] = 'number';
97 $item->fieldAttr['class'] = 'maxwidth50';
98 $item->fieldParams['tdOutputFieldClass'] = 'right';
99
100 $item = $formSetup->newItem('ACCOUNTING_LENGTH_AACCOUNT')->setAsString();
101 $item->fieldAttr['type'] = 'number';
102 $item->fieldAttr['class'] = 'maxwidth50';
103 $item->fieldParams['tdOutputFieldClass'] = 'right';
104}
105
106// Parameters ACCOUNTING_* and others
107$list = array(
108 'ACCOUNTING_LENGTH_GACCOUNT',
109 'ACCOUNTING_LENGTH_AACCOUNT',
110);
111
112$list_binding = array(
113 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER',
114 'ACCOUNTING_DATE_START_BINDING',
115 'ACCOUNTING_LABEL_OPERATION_ON_TRANSFER'
116);
117
118// Parameters for export options
119$main_option = array(
120 'ACCOUNTING_EXPORT_PREFIX_SPEC',
121);
122
123$accountancyexport = new AccountancyExport($db);
124$configuration = $accountancyexport->getTypeConfig();
125
126$listparam = $configuration['param'];
127$listformat = $configuration['format'];
128$listcr = $configuration['cr'];
129
130$model_option = array(
131 '1' => array(
132 'label' => 'ACCOUNTING_EXPORT_FORMAT',
133 'param' => $listformat,
134 ),
135 '2' => array(
136 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
137 'param' => '',
138 ),
139 '3' => array(
140 'label' => 'ACCOUNTING_EXPORT_ENDLINE',
141 'param' => $listcr,
142 ),
143 '4' => array(
144 'label' => 'ACCOUNTING_EXPORT_DATE',
145 'param' => '',
146 ),
147);
148
149$error = 0;
150
151$accounting_mode = getDolGlobalString('ACCOUNTING_MODE', 'CREANCES-DETTES');
152
153
154/*
155 * Actions
156 */
157
158include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
159
160if (in_array($action, array('setACCOUNTANCY_ER_DATE_RECORD', 'setACCOUNTING_BANK_CONCILIATED'))) {
161 $constname = preg_replace('/^set/', '', $action);
162 $constvalue = GETPOSTINT('value');
163 $res = dolibarr_set_const($db, $constname, $constvalue, '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
175if ($action == 'updatemode') {
176 $error = 0;
177
178 $accounting_modes = array(
179 'CREANCES-DETTES',
180 'RECETTES-DEPENSES'
181 );
182
183 $accounting_mode = GETPOST('accounting_mode', 'alpha');
184
185 if (in_array($accounting_mode, $accounting_modes)) {
186 if (dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
187 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
188 } else {
189 $error++;
190 }
191 } else {
192 $error++;
193 }
194}
195
196if ($action == 'update') {
197 $error = 0;
198
199 foreach ($list as $constname) {
200 $constvalue = GETPOST($constname, 'alpha');
201
202 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
203 $error++;
204 }
205 }
206
207 if (!$error) {
208 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
209 } else {
210 setEventMessages($langs->trans("Error"), null, 'errors');
211 }
212}
213
214if ($action == 'update_binding') {
215 $error = 0;
216
217 foreach ($list_binding as $constname) {
218 $constvalue = GETPOST($constname, 'alpha');
219
220 if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
221 $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year'));
222 }
223
224 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
225 $error++;
226 }
227 }
228
229 if (!$error) {
230 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
231 } else {
232 setEventMessages($langs->trans("Error"), null, 'errors');
233 }
234}
235
236if ($action == 'update_advanced') {
237 $error = 0;
238
239 if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) {
240 if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) {
241 $error++;
242 }
243 }
244
245 if (!$error) {
246 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
247 } else {
248 setEventMessages($langs->trans("Error"), null, 'errors');
249 }
250}
251
252if ($action == 'update_export') {
253 $error = 0;
254
255 // Export options
256 $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV');
257
258 // reload
259 $configuration = $accountancyexport->getTypeConfig();
260 $listparam = $configuration['param'];
261
262 if (!empty($modelcsv)) {
263 if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
264 $error++;
265 }
266 //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
267 // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
268 //}
269 } else {
270 $error++;
271 }
272
273 foreach ($main_option as $constname) {
274 $constvalue = GETPOST($constname, 'alpha');
275
276 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
277 $error++;
278 }
279 }
280
281 foreach ($listparam[$modelcsv] as $key => $value) {
282 $constante = $key;
283
284 if (strpos($constante, 'ACCOUNTING') !== false) {
285 $constvalue = GETPOST($key, 'alpha');
286 if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
287 $error++;
288 }
289 }
290 }
291
292 if (!$error) {
293 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
294 } else {
295 setEventMessages($langs->trans("Error"), null, 'errors');
296 }
297}
298
299if ($action == 'setenabledraftexport') {
300 $setenabledraftexport = GETPOSTINT('value');
301 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
302 if (!($res > 0)) {
303 $error++;
304 }
305
306 if (!$error) {
307 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
308 } else {
309 setEventMessages($langs->trans("Error"), null, 'mesgs');
310 }
311}
312
313if ($action == 'setdisablebindingonsales') {
314 $setdisablebindingonsales = GETPOSTINT('value');
315 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
316 if (!($res > 0)) {
317 $error++;
318 }
319
320 if (!$error) {
321 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
322 } else {
323 setEventMessages($langs->trans("Error"), null, 'mesgs');
324 }
325}
326
327if ($action == 'setdisablebindingonpurchases') {
328 $setdisablebindingonpurchases = GETPOSTINT('value');
329 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
330 if (!($res > 0)) {
331 $error++;
332 }
333
334 if (!$error) {
335 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
336 } else {
337 setEventMessages($langs->trans("Error"), null, 'mesgs');
338 }
339}
340
341if ($action == 'setdisablebindingonexpensereports') {
342 $setdisablebindingonexpensereports = GETPOSTINT('value');
343 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
344 if (!($res > 0)) {
345 $error++;
346 }
347
348 if (!$error) {
349 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
350 } else {
351 setEventMessages($langs->trans("Error"), null, 'mesgs');
352 }
353}
354
355if ($action == 'setdisabletransferonassets') {
356 $setdisabletransferonassets = GETPOSTINT('value');
357 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS", $setdisabletransferonassets, 'yesno', 0, '', $conf->entity);
358 if (!($res > 0)) {
359 $error++;
360 }
361
362 if (!$error) {
363 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
364 } else {
365 setEventMessages($langs->trans("Error"), null, 'mesgs');
366 }
367}
368
369if ($action == 'setdisabletransferondiscounts') {
370 $setdisabletransferondiscounts = GETPOSTINT('value');
371 $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS", $setdisabletransferondiscounts, 'yesno', 0, '', $conf->entity);
372 if (!($res > 0)) {
373 $error++;
374 }
375
376 if (!$error) {
377 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
378 } else {
379 setEventMessages($langs->trans("Error"), null, 'mesgs');
380 }
381}
382
383if ($action == 'setenablelettering') {
384 $setenablelettering = GETPOSTINT('value');
385 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
386 if (!($res > 0)) {
387 $error++;
388 }
389
390 if (!$error) {
391 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
392 } else {
393 setEventMessages($langs->trans("Error"), null, 'mesgs');
394 }
395}
396
397if ($action == 'setenableautolettering') {
398 $setenableautolettering = GETPOSTINT('value');
399 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
400 if (!($res > 0)) {
401 $error++;
402 }
403
404 if (!$error) {
405 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
406 } else {
407 setEventMessages($langs->trans("Error"), null, 'mesgs');
408 }
409}
410
411if ($action == 'setenablevatreversecharge') {
412 $setenablevatreversecharge = GETPOSTINT('value');
413 $res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
414 if (!($res > 0)) {
415 $error++;
416 }
417
418 if (!$error) {
419 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
420 } else {
421 setEventMessages($langs->trans("Error"), null, 'mesgs');
422 }
423}
424
425if ($action == 'setenabletabonthirdparty') {
426 $setenabletabonthirdparty = GETPOSTINT('value');
427 $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_TABONTHIRDPARTY", $setenabletabonthirdparty, 'yesno', 0, '', $conf->entity);
428 if (!($res > 0)) {
429 $error++;
430 }
431
432 if (!$error) {
433 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
434 } else {
435 setEventMessages($langs->trans("Error"), null, 'mesgs');
436 }
437}
438
439if ($action == 'setenabledissociatecashsales') {
440 $setenabledissociatecashsales = GETPOSTINT('value');
441 $res = dolibarr_set_const($db, "ACCOUNTING_DISSOCIATE_CASH_SALES", $setenabledissociatecashsales, 'yesno', 0, '', $conf->entity);
442 if (!($res > 0)) {
443 $error++;
444 }
445
446 if (!$error) {
447 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
448 } else {
449 setEventMessages($langs->trans("Error"), null, 'mesgs');
450 }
451}
452
453if ($action == 'setexportenablelettering') {
454 $setexportenablelettering = GETPOSTINT('value');
455 $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING", $setexportenablelettering, 'yesno', 0, '', $conf->entity);
456 if (!($res > 0)) {
457 $error++;
458 }
459
460 if (!$error) {
461 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
462 } else {
463 setEventMessages($langs->trans("Error"), null, 'mesgs');
464 }
465}
466
467if ($action == 'setexportenableexportdate') {
468 $setexportenableexportdate = GETPOSTINT('value');
469 $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE", $setexportenableexportdate, 'yesno', 0, '', $conf->entity);
470 if (!($res > 0)) {
471 $error++;
472 }
473
474 if (!$error) {
475 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
476 } else {
477 setEventMessages($langs->trans("Error"), null, 'mesgs');
478 }
479}
480
481if ($action == 'setexportenablevalidationdate') {
482 $setexportenablevalidationdate = GETPOSTINT('value');
483 $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE", $setexportenablevalidationdate, 'yesno', 0, '', $conf->entity);
484 if (!($res > 0)) {
485 $error++;
486 }
487
488 if (!$error) {
489 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
490 } else {
491 setEventMessages($langs->trans("Error"), null, 'mesgs');
492 }
493}
494
495if ($action == 'setexportenablefull') {
496 $setexportenablefull = GETPOSTINT('value');
497 $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL", $setexportenablefull, 'yesno', 0, '', $conf->entity);
498 if (!($res > 0)) {
499 $error++;
500 }
501
502 if (!$error) {
503 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
504 } else {
505 setEventMessages($langs->trans("Error"), null, 'mesgs');
506 }
507}
508
509if ($action == 'updateMask') {
510 $maskconstbookkeeping = GETPOST('maskconstbookkeeping', 'aZ09');
511 $maskbookkeeping = GETPOST('maskbookkeeping', 'alpha');
512
513 $res = 0;
514
515 if ($maskconstbookkeeping && preg_match('/_MASK$/', $maskconstbookkeeping)) {
516 $res = dolibarr_set_const($db, $maskconstbookkeeping, $maskbookkeeping, 'chaine', 0, '', $conf->entity);
517 }
518
519 if (!($res > 0)) {
520 $error++;
521 }
522
523 if (!$error) {
524 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
525 } else {
526 setEventMessages($langs->trans("Error"), null, 'errors');
527 }
528}
529
530if ($action == 'setmod') {
531 $value = GETPOST('value', 'alpha');
532 dolibarr_set_const($db, "BOOKKEEPING_ADDON", $value, 'chaine', 0, '', $conf->entity);
533}
534
535/*
536 * View
537 */
538
539$form = new Form($db);
540
541$title = $langs->trans('ConfigAccountingExpert');
542$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
543llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_index');
544
545
546$linkback = '';
547//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
548print load_fiche_titre($title, $linkback, 'accountancy');
549
550
551// Show message if accountancy hidden options are activated to help to resolve some problems
552if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
553 print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
554}
555if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
556 print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
557}
558if (getDolGlobalString('ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY')) {
559 print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
560}
561if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
562 print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
563}
564if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
565 print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
566}
567
568print '<br>';
569
570
571// Case of the parameter ACCOUNTING_MODE
572print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
573print '<input type="hidden" name="token" value="'.newToken().'">';
574print '<input type="hidden" name="action" value="updatemode">';
575
576print '<table class="noborder centpercent">';
577
578print '<tr class="liste_titre">';
579print '<td colspan="2">'.$langs->trans('OptionMode').'</td>';
580print "</tr>\n";
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>';
583print "</td></tr>\n";
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>";
586print "</td></tr>\n";
587
588print "</table>\n";
589
590print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Save').'"></div>';
591print '</form>';
592
593print '<br><br>';
594
595// Show form main options
596print $formSetup->generateOutput(true);
597
598print '<br><br>';
599
600
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="">';
605
606// Binding params
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>';
611print "</tr>\n";
612
613// Param a user $user->hasRight('accounting', 'chartofaccount') can access
614foreach ($list_binding as $key) {
615 print '<tr class="oddeven value">';
616
617 // Param
618 $label = $langs->trans($key);
619 print '<td>'.$label.'</td>';
620 // Value
621 print '<td class="right minwidth75imp parentonrightofpage">';
622 if ($key == 'ACCOUNTING_DATE_START_BINDING') {
623 print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
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') {
628 $array = array(
629 0 => $langs->trans("ThirdPartyName") . ' - ' . $langs->trans("NumPiece") . ' - ' . $langs->trans("LabelAccount"),
630 1 => $langs->trans("ThirdPartyName") . ' - ' . $langs->trans("NumPiece"),
631 2 => $langs->trans("ThirdPartyName")
632 );
633 print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width300');
634 } else {
635 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
636 }
637
638 print '</td>';
639 print '</tr>';
640}
641
642print '<tr class="oddeven">';
643print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
644if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
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');
647 print '</a></td>';
648} else {
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');
651 print '</a></td>';
652}
653print '</tr>';
654
655print '<tr class="oddeven">';
656print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
657if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) {
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');
660 print '</a></td>';
661} else {
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');
664 print '</a></td>';
665}
666print '</tr>';
667
668print '<tr class="oddeven">';
669print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
670if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
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');
673 print '</a></td>';
674} else {
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');
677 print '</a></td>';
678}
679print '</tr>';
680
681print '<tr class="oddeven">';
682print '<td>'.$langs->trans("ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS").'</td>';
683if (getDolGlobalString('ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS')) {
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');
686 print '</a></td>';
687} else {
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');
690 print '</a></td>';
691}
692print '</tr>';
693
694print '<tr class="oddeven">';
695print '<td>'.$langs->trans("ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS").'</td>';
696if (getDolGlobalString('ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS')) {
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');
699 print '</a></td>';
700} else {
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');
703 print '</a></td>';
704}
705print '</tr>';
706
707if (!getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
708 print '<tr class="oddeven">';
709 print '<td>'.$langs->trans("ACCOUNTANCY_ER_DATE_RECORD").'</td>';
710 if (getDolGlobalInt('ACCOUNTANCY_ER_DATE_RECORD')) {
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');
713 print '</a></td>';
714 } else {
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');
717 print '</a></td>';
718 }
719 print '</tr>';
720}
721
722print '<tr class="oddeven">';
723print '<td>'.$langs->trans("ACCOUNTING_BANK_CONCILIATED").'</td>';
724if (getDolGlobalInt('ACCOUNTING_BANK_CONCILIATED') == 2) {
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');
727 print '</a></td>';
728} else {
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');
731 print '</a></td>';
732}
733print '</tr>';
734
735print '</table>';
736print '</div>';
737
738print '<div class="center"><input type="submit" class="button button-edit reposition" name="button" value="'.dol_escape_htmltag($langs->trans('Save')).'"></div>';
739print '</form>';
740
741// Show numbering options
742print '<br><br>';
743
744// Accountancy Numbering model
745$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
746
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>';
754print '</tr>'."\n";
755
756clearstatcache();
757
758$arrayofmodules = array();
759
760foreach ($dirmodels as $reldir) {
761 $dir = dol_buildpath($reldir."core/modules/accountancy/");
762
763 if (is_dir($dir)) {
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') {
768 $file = dol_substr($file, 0, dol_strlen($file) - 4);
769
770 require_once $dir.$file.'.php';
771
772 $module = new $file($db);
773
775 '@phan-var-force ModeleNumRefBookkeeping $module';
776
777 $arrayofmodules[] = $module;
778 }
779 }
780 closedir($handle);
781 }
782 }
783}
784
785$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
786
787foreach ($arrayofmodules as $module) {
788 $file = 'mod_bookkeeping_'.strtolower($module->getName($langs));
789
790 // Show modules according to features level
791 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
792 continue;
793 }
794 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
795 continue;
796 }
797
798 if ($module->isEnabled()) {
799 print '<tr class="oddeven"><td class="width100">'.$module->name."</td><td>\n";
800 print $module->info($langs);
801 print '</td>';
802
803 // Show example of the numbering model
804 print '<td class="nowrap">';
805 $tmp = $module->getExample();
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>';
811 } else {
812 print $tmp;
813 }
814 print '</td>'."\n";
815
816 print '<td class="center">';
817 if (getDolGlobalString('BOOKKEEPING_ADDON') == $file) {
818 print img_picto($langs->trans("Activated"), 'switch_on');
819 } else {
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');
822 print '</a>';
823 }
824 print '</td>';
825
826 $bookkeeping = new BookKeeping($db);
827 $bookkeeping->initAsSpecimen();
828
829 // Info
830 $htmltooltip = ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
831
832 $nextval = $module->getNextValue($bookkeeping);
833 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
834 $htmltooltip .= ''.$langs->trans("NextValue").': ';
835 if ($nextval) {
836 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
837 $nextval = $langs->trans($nextval);
838 }
839 $htmltooltip .= $nextval.'<br>';
840 } else {
841 $htmltooltip .= $langs->trans($module->error).'<br>';
842 }
843 }
844
845 print '<td class="center">';
846 print $form->textwithpicto('', $htmltooltip, 1, 'info');
847 print '</td>';
848
849 print "</tr>\n";
850 }
851}
852print '</table>';
853print '</div>';
854print '</form>';
855
856// Show advanced options
857print '<br><br>';
858
859// Advanced params
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="">';
864
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>';
869print "</tr>\n";
870
871print '<tr class="oddeven">';
872print '<td>';
873print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
874if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
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');
877 print '</a></td>';
878} else {
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');
881 print '</a></td>';
882}
883print '</tr>';
884
885if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
886 // Number of letters for lettering (3 by default (AAA), min 2 (AA))
887 print '<tr class="oddeven">';
888 print '<td>';
889 print $form->textwithpicto($langs->trans("ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans("ACCOUNTING_LETTERING_NBLETTERS_DESC")) . '</td>';
890 print '<td class="right">';
891
892 if (empty($letter)) {
893 if (getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS')) {
894 $nbletter = getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS');
895 } else {
896 $nbletter = 3;
897 }
898 }
899
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";
901 print '</tr>';
902
903 // Auto matching when transfer in accountancy is realized
904 print '<tr class="oddeven">';
905 print '<td>';
906 print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
907 if (getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
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');
910 print '</a></td>';
911 } else {
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');
914 print '</a></td>';
915 }
916 print '</tr>';
917}
918
919print '<tr class="oddeven">';
920print '<td>';
921print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
922if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
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');
925 print '</a></td>';
926} else {
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');
929 print '</a></td>';
930}
931print '</tr>';
932
933print '<tr class="oddeven">';
934print '<td>';
935print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_TABONTHIRDPARTY"), $langs->trans("ACCOUNTING_ENABLE_TABONTHIRDPARTY_DESC")).'</td>';
936if (getDolGlobalString('ACCOUNTING_ENABLE_TABONTHIRDPARTY')) {
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');
939 print '</a></td>';
940} else {
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');
943 print '</a></td>';
944}
945print '</tr>';
946
947print '<tr class="oddeven">';
948print '<td>';
949print $form->textwithpicto($langs->trans("AccountingDissociateCashSales"), $langs->trans("AccountingDissociateCashSalesDesc")).'</td>';
950if (getDolGlobalString('ACCOUNTING_DISSOCIATE_CASH_SALES')) {
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');
953 print '</a></td>';
954} else {
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');
957 print '</a></td>';
958}
959print '</tr>';
960
961print '</table>';
962print '</div>';
963
964
965print '<div class="center"><input type="submit" class="button button-edit reposition" name="button" value="'.$langs->trans('Save').'"></div>';
966print '</form>';
967
968
969print '<br><br>';
970
971
972// Export options
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="">';
977
978print "\n".'<script type="text/javascript">'."\n";
979print 'jQuery(document).ready(function () {'."\n";
980print ' function initfields()'."\n";
981print ' {'."\n";
982foreach ($listparam as $key => $param) {
983 print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
984 print ' {'."\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";
989 } else {
990 print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
991 print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
992 }
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";
996 } else {
997 print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV').'");'."\n";
998 print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
999 }
1000 if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
1001 print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
1002 } else {
1003 print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
1004 }
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";
1008 } else {
1009 print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.getDolGlobalString('ACCOUNTING_EXPORT_DATE').'");'."\n";
1010 print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
1011 }
1012 print ' }'."\n";
1013}
1014print ' }'."\n";
1015print ' initfields();'."\n";
1016print ' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'."\n";
1017print ' initfields();'."\n";
1018print ' });'."\n";
1019print '})'."\n";
1020print '</script>'."\n";
1021
1022print '<table class="noborder centpercent">';
1023print '<tr class="liste_titre">';
1024print '<td colspan="2">'.$langs->trans('ExportOptions').'</td>';
1025print "</tr>\n";
1026
1027$num = count($main_option);
1028if ($num) {
1029 foreach ($main_option as $key) {
1030 print '<tr class="oddeven value">';
1031
1032 // Param
1033 $label = $langs->trans($key);
1034 print '<td>'.dol_escape_htmltag($label).'</td>';
1035
1036 // Value
1037 print '<td>';
1038 print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
1039 print '</td></tr>';
1040 }
1041}
1042
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");
1048 print "</td>";
1049} else {
1050 print '<td>';
1051 $listofexporttemplates = $accountancyexport->getType(1);
1052 print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates, getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0, '', 0, 0, 0, '', '', 1);
1053 print '</td>';
1054}
1055print "</tr>";
1056
1057
1058$num2 = count($model_option);
1059if ($num2) {
1060 foreach ($model_option as $key) {
1061 print '<tr class="oddeven value">';
1062
1063 // Param
1064 $label = $key['label'];
1065 print '<td>'.$langs->trans($label).'</td>';
1066
1067 // Value
1068 print '<td>';
1069 if (is_array($key['param'])) {
1070 print $form->selectarray($label, $key['param'], getDolGlobalString($label), 0);
1071 } else {
1072 print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.getDolGlobalString($label).'">';
1073 }
1074
1075 print '</td></tr>';
1076 }
1077}
1078
1079print '<tr class="oddeven">';
1080print '<td>';
1081print $form->textwithpicto($langs->trans("AccountingDefaultNotExportLettering"), $langs->trans("AccountingDefaultNotExportLetteringDesc")) . '</td>';
1082if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING')) {
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');
1085 print '</a></td>';
1086} else {
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');
1089 print '</a></td>';
1090}
1091print '</tr>';
1092
1093print '<tr class="oddeven">';
1094print '<td>';
1095print $form->textwithpicto($langs->trans("AccountingDefaultNotNotifiedExportDate"), $langs->trans("AccountingDefaultNotNotifiedExportDateDesc")) . '</td>';
1096if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE')) {
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');
1099 print '</a></td>';
1100} else {
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');
1103 print '</a></td>';
1104}
1105print '</tr>';
1106
1107print '<tr class="oddeven">';
1108print '<td>';
1109print $form->textwithpicto($langs->trans("AccountingDefaultNotifiedValidationDate"), $langs->trans("AccountingDefaultNotifiedValidationDateDesc")) . '</td>';
1110if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE')) {
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');
1113 print '</a></td>';
1114} else {
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');
1117 print '</a></td>';
1118}
1119print '</tr>';
1120
1121print '<tr class="oddeven">';
1122print '<td>';
1123print $form->textwithpicto($langs->trans("AccountingDefaultNotifiedExportFull"), $langs->trans("AccountingDefaultNotifiedExportFullDesc")) . '</td>';
1124if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL')) {
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');
1127 print '</a></td>';
1128} else {
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');
1131 print '</a></td>';
1132}
1133print '</tr>';
1134
1135print "</table>\n";
1136
1137print '<div class="center"><input type="submit" class="button reposition" value="'.dol_escape_htmltag($langs->trans('Save')).'" name="button"></div>';
1138
1139print '</form>';
1140
1141// End of page
1142llxFooter();
1143$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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Manage the different format accountancy export.
Class to manage Ledger (General Ledger and Subledger)
Class to manage generation of HTML components Only common components must be here.
This class help you create setup render.
if(! $sortfield) if(! $sortorder) $module
Definition list.php:193
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.