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