dolibarr 21.0.0-beta
conf.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
4 * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23
34class Conf extends stdClass
35{
39 public $file;
40
44 public $db;
45
49 public $global;
50
54 public $browser;
55
57 public $mycompany;
58
62 public $admin;
63
67 public $medias;
68
72 public $multicompany;
73
76 public $delivery_note;
77
81 public $use_javascript_ajax;
82
86 public $disable_compute;
87
91 public $currency;
92
96 public $theme;
97
101 public $css;
102
106 public $email_from;
107
111 public $standard_menu;
112
116 public $modules;
120 public $modules_parts;
121
125 public $cache;
126
130 public $headerdone;
131
135 public $logbuffer = array();
136
140 public $loghandlers = array();
141
145 public $entity = 1;
146
150 public $entities = array();
151
155 public $dol_hide_topmenu;
156
160 public $dol_hide_leftmenu;
161
165 public $dol_optimize_smallscreen;
166
170 public $dol_no_mouse_hover;
174 public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url. 0=default, 1=to say we use app from a webview app, 2=to say we use app from a webview app and keep ajax
175
176 public $format_date_short; // Format of day with PHP/C tags (strftime functions)
177 public $format_date_short_java; // Format of day with Java tags
178 public $format_hour_short;
179 public $format_hour_short_duration;
180 public $format_date_text_short;
181 public $format_date_text;
182 public $format_date_hour_short;
183 public $format_date_hour_sec_short;
184 public $format_date_hour_text_short;
185 public $format_date_hour_text;
186
190 public $liste_limit;
191
195 public $main_checkbox_left_column;
196
200 public $tzuserinputkey = 'tzserver';
201
202
203 // TODO Remove this part.
204
208 public $fournisseur;
209
213 public $product;
214
219 public $produit;
220
224 public $service;
225
230 public $contrat;
231
235 public $contract;
236
240 public $actions;
241
245 public $agenda;
246
250 public $propal;
251
256 public $commande;
257
261 public $order;
262
267 public $facture;
268
272 public $invoice;
273
277 public $user;
278
283 public $adherent;
284
288 public $member;
289
293 public $bank;
294
298 public $notification;
299
303 public $expensereport;
304
308 public $productbatch;
312 public $projet;
313
317 public $project;
318
322 public $supplier_proposal;
323
327 public $supplier_order;
328
332 public $supplier_invoice;
333
337 public $category;
338
339
343 public function __construct()
344 {
345 // Properly declare multi-modules objects.
346 $this->file = new stdClass();
347 $this->db = new stdClass();
349 $this->file->character_set_client = 'UTF-8'; // UTF-8, ISO-8859-1
350
351 // Common objects that are not modules
352 $this->mycompany = new stdClass();
353 $this->admin = new stdClass();
354 $this->medias = new stdClass();
355 $this->global = new stdClass();
356
357 // Common objects that are not modules and set by the main and not into the this->setValues()
358 $this->browser = new stdClass();
359
360 // Common arrays
361 $this->cache = array();
362 $this->modules = array();
363 $this->modules_parts = array(
364 'css' => array(),
365 'js' => array(),
366 'tabs' => array(),
367 'triggers' => array(),
368 'login' => array(),
369 'substitutions' => array(),
370 'menus' => array(),
371 'theme' => array(),
372 'sms' => array(),
373 'tpl' => array(),
374 'barcode' => array(),
375 'models' => array(),
376 'societe' => array(),
377 'member' => array(),
378 'hooks' => array(),
379 'dir' => array(),
380 'syslog' => array(),
381 'websitetemplates' => array(),
382 //'captcha' => array() // Can be removed,this does not generates warning
383 );
384
385 // First level object that are modules.
386 // TODO Remove this part.
387 $this->multicompany = new stdClass();
388 $this->fournisseur = new stdClass();
389 $this->product = new stdClass();
390 $this->service = new stdClass();
391 $this->contrat = new stdClass();
392 $this->actions = new stdClass();
393 $this->agenda = new stdClass();
394 $this->commande = new stdClass();
395 $this->propal = new stdClass();
396 $this->facture = new stdClass();
397 $this->user = new stdClass();
398 $this->adherent = new stdClass();
399 $this->bank = new stdClass();
400 $this->mailing = new stdClass();
401 $this->notification = new stdClass();
402 $this->expensereport = new stdClass();
403 $this->productbatch = new stdClass();
404 $this->api = new stdClass();
405 }
406
407
416 public function setEntityValues($db, $entity)
417 {
418 if ($this->entity != $entity) {
419 // If we ask to reload setup for a new entity
420 $this->entity = $entity;
421 return $this->setValues($db);
422 }
423
424 return 0;
425 }
426
434 public function setValues($db)
435 {
436 dol_syslog(get_class($this)."::setValues");
437
438 // Unset all old modules values
439 if (!empty($this->modules)) {
440 foreach ($this->modules as $m) {
441 if (isset($this->$m)) {
442 unset($this->$m);
443 }
444 }
445 }
446
447 // Common objects that are not modules
448 $this->mycompany = new stdClass();
449 $this->admin = new stdClass();
450 $this->medias = new stdClass();
451 $this->global = new stdClass();
452
453 // Common objects that are not modules and set by the main and not into the this->setValues()
454 //$this->browser = new stdClass(); // This is set by main and not into this setValues(), so we keep it intact.
455
456 // First level object
457 // TODO Remove this part.
458 $this->fournisseur = new stdClass();
459 $this->compta = new stdClass();
460 $this->product = new stdClass();
461 $this->service = new stdClass();
462 $this->contrat = new stdClass();
463 $this->actions = new stdClass();
464 $this->agenda = new stdClass();
465 $this->commande = new stdClass();
466 $this->propal = new stdClass();
467 $this->facture = new stdClass();
468 $this->user = new stdClass();
469 $this->adherent = new stdClass();
470 $this->bank = new stdClass();
471 $this->notification = new stdClass();
472 $this->expensereport = new stdClass();
473 $this->productbatch = new stdClass();
474
475 // Common arrays
476 $this->cache = array();
477 $this->modules = array();
478 $this->modules_parts = array(
479 'css' => array(),
480 'js' => array(),
481 'tabs' => array(),
482 'triggers' => array(),
483 'login' => array(),
484 'substitutions' => array(),
485 'menus' => array(),
486 'theme' => array(),
487 'sms' => array(),
488 'tpl' => array(),
489 'barcode' => array(),
490 'models' => array(),
491 'societe' => array(),
492 'member' => array(),
493 'hooks' => array(),
494 'dir' => array(),
495 'syslog' => array(),
496 'websitetemplates' => array(),
497 );
498
499 if (!is_null($db) && is_object($db)) {
500 include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
501
502 // Define all global constants into $this->global->key=value
503 $sql = "SELECT ".$db->decrypt('name')." as name,";
504 $sql .= " ".$db->decrypt('value')." as value, entity";
505 $sql .= " FROM ".$db->prefix()."const";
506 $sql .= " WHERE entity IN (0,".$this->entity.")";
507 $sql .= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
508
509 $resql = $db->query($sql);
510 if ($resql) {
511 $i = 0;
512 $numr = $db->num_rows($resql);
513 while ($i < $numr) {
514 $objp = $db->fetch_object($resql);
515 $key = $objp->name;
516 $value = $objp->value;
517 if ($key) {
518 // Allow constants values to be overridden by environment variables
519 if (isset($_SERVER['DOLIBARR_'.$key])) {
520 $value = $_SERVER['DOLIBARR_'.$key];
521 } elseif (isset($_ENV['DOLIBARR_'.$key])) {
522 $value = $_ENV['DOLIBARR_'.$key];
523 }
524
525 $this->global->$key = dolDecrypt($value); // decrypt data excrypted with dolibarr_set_const($db, $name, $value)
526
527 if ($value && strpos($key, 'MAIN_MODULE_') === 0) {
528 $reg = array();
529 // If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
530 if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) {
531 $partname = 'tabs';
532 $params = explode(':', $value, 2);
533 if (!is_array($this->modules_parts[$partname])) {
534 $this->modules_parts[$partname] = array();
535 }
536 $this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array
537 } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
538 // If this is a constant for all generic part activated by a module. It initializes
539 // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
540 // modules_parts['models'], modules_parts['theme']
541 // modules_parts['sms'],
542 // modules_parts['css'], modules_parts['js'],...
543
544 $modulename = strtolower($reg[1]);
545 $partname = strtolower($reg[2]);
546 if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
547 $this->modules_parts[$partname] = array();
548 }
549
550 //$arrValue = json_decode($value, true, null, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
551 $arrValue = json_decode($value, true);
552 //var_dump($key); var_dump($value); var_dump($arrValue);
553
554 if (is_array($arrValue)) {
555 $newvalue = $arrValue;
556 } elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) {
557 $newvalue = '/'.$modulename.'/core/'.$partname.'/';
558 } elseif (in_array($partname, array('models', 'theme', 'websitetemplates'))) {
559 $newvalue = '/'.$modulename.'/';
560 } elseif (in_array($partname, array('captcha'))) {
561 $newvalue = '/'.$modulename.'/core/modules/security/'.$partname.'/';
562 } elseif ($value == 1) {
563 $newvalue = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
564 } else { // $partname can be any other value like 'sms', ...
565 $newvalue = $value;
566 }
567
568 if (!empty($newvalue)) {
569 $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $newvalue)); // $value may be a string or an array
570 }
571 } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
572 // If this is a module constant (must be at end)
573 $modulename = strtolower($reg[1]);
574 if ($modulename == 'propale') {
575 $modulename = 'propal';
576 }
577 if ($modulename == 'supplierproposal') {
578 $modulename = 'supplier_proposal';
579 }
580 $this->modules[$modulename] = $modulename; // Add this module in list of enabled modules
581
582 // deprecated in php 8.2
583 //if (version_compare(phpversion(), '8.2') < 0) {
584 if (!isset($this->$modulename) || !is_object($this->$modulename)) {
585 $this->$modulename = new stdClass(); // We need this to use the ->enabled and the ->multidir, ->dir...
586 }
587 $this->$modulename->enabled = true; // TODO Remove this
588
589 // Duplicate entry with the new name
590 /*
591 $mapping = $this->deprecatedProperties();
592 if (array_key_exists($modulename, $mapping)) {
593 $newmodulename = $mapping[$modulename];
594 $this->modules[$newmodulename] = $newmodulename;
595
596 if (!isset($this->$newmodulename) || !is_object($this->$newmodulename)) {
597 $this->$newmodulename = new stdClass(); // We need this to use the ->enabled and the ->multidir, ->dir...
598 }
599 $this->$newmodulename->enabled = true; // TODO Remove this
600 }
601 */
602 }
603 }
604 }
605 $i++;
606 }
607
608 $db->free($resql);
609 }
610
611 // Include other local file xxx/zzz_consts.php to overwrite some variables
612 if (!empty($this->global->LOCAL_CONSTS_FILES)) {
613 $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
614 foreach ($filesList as $file) {
615 $file = dol_sanitizeFileName($file);
616 dol_include_once($file."/".$file."_consts.php"); // This file can run code like setting $this->global->XXX vars.
617 }
618 }
619
620 //var_dump($this->modules);
621 //var_dump($this->modules_parts['theme']);
622
623 // If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
624 // In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
625 //$this->global->MAIN_SERVER_TZ='Europe/Paris';
626 if (!empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') {
627 try {
628 date_default_timezone_set($this->global->MAIN_SERVER_TZ);
629 } catch (Exception $e) {
630 dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR);
631 }
632 }
633
634 // Object $mc
635 if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) {
636 global $mc;
637 $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
638 if ($ret && class_exists('ActionsMulticompany')) {
639 $mc = new ActionsMulticompany($db);
640 }
641 }
642
643 // Clean some variables
644 if (empty($this->global->MAIN_MENU_STANDARD)) {
645 $this->global->MAIN_MENU_STANDARD = "eldy_menu.php";
646 }
647 if (empty($this->global->MAIN_MENUFRONT_STANDARD)) {
648 $this->global->MAIN_MENUFRONT_STANDARD = "eldy_menu.php";
649 }
650 if (empty($this->global->MAIN_MENU_SMARTPHONE)) {
651 $this->global->MAIN_MENU_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
652 }
653 if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) {
654 $this->global->MAIN_MENUFRONT_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
655 }
656 if (!isset($this->global->FACTURE_TVAOPTION)) {
657 $this->global->FACTURE_TVAOPTION = 1;
658 }
659
660 // Variable globales LDAP
661 if (empty($this->global->LDAP_FIELD_FULLNAME)) {
662 $this->global->LDAP_FIELD_FULLNAME = '';
663 }
664 if (!isset($this->global->LDAP_KEY_USERS)) {
665 $this->global->LDAP_KEY_USERS = $this->global->LDAP_FIELD_FULLNAME;
666 }
667 if (!isset($this->global->LDAP_KEY_GROUPS)) {
668 $this->global->LDAP_KEY_GROUPS = $this->global->LDAP_FIELD_FULLNAME;
669 }
670 if (!isset($this->global->LDAP_KEY_CONTACTS)) {
671 $this->global->LDAP_KEY_CONTACTS = $this->global->LDAP_FIELD_FULLNAME;
672 }
673 if (!isset($this->global->LDAP_KEY_MEMBERS)) {
674 $this->global->LDAP_KEY_MEMBERS = $this->global->LDAP_FIELD_FULLNAME;
675 }
676 if (!isset($this->global->LDAP_KEY_MEMBERS_TYPES)) {
677 $this->global->LDAP_KEY_MEMBERS_TYPES = $this->global->LDAP_FIELD_FULLNAME;
678 }
679
680 // Load translation object with current language
681 if (empty($this->global->MAIN_LANG_DEFAULT)) {
682 $this->global->MAIN_LANG_DEFAULT = "en_US";
683 }
684
685 $rootfordata = DOL_DATA_ROOT;
686 $rootforuser = DOL_DATA_ROOT;
687 // If multicompany module is enabled, we redefine the root of data
688 if (isModEnabled('multicompany') && !empty($this->entity) && $this->entity > 1) {
689 $rootfordata .= '/'.$this->entity;
690 }
691 // Set standard temporary folder name or global override
692 $rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR;
693
694 // Define default dir_output and dir_temp for directories of modules
695 foreach ($this->modules as $module) {
696 //var_dump($module);
697 // For multicompany sharings
698 $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
699 $this->$module->multidir_temp = array($this->entity => $rootfortemp."/".$module."/temp");
700 // For backward compatibility
701 $this->$module->dir_output = $rootfordata."/".$module;
702 $this->$module->dir_temp = $rootfortemp."/".$module."/temp";
703 }
704
705 // External modules storage
706 if (!empty($this->modules_parts['dir'])) {
707 foreach ($this->modules_parts['dir'] as $module => $dirs) {
708 if (!empty($this->$module->enabled)) {
709 foreach ($dirs as $type => $name) { // $type is 'output' or 'temp'
710 $multidirname = 'multidir_'.$type;
711 $dirname = 'dir_'.$type;
712
713 if ($type != 'temp') {
714 // For multicompany sharings
715 $this->$module->$multidirname = array($this->entity => $rootfordata."/".$name);
716
717 // For backward compatibility
718 $this->$module->$dirname = $rootfordata."/".$name;
719 } else {
720 // For multicompany sharings
721 $this->$module->$multidirname = array($this->entity => $rootfortemp."/".$name."/temp");
722
723 // For backward compatibility
724 $this->$module->$dirname = $rootfortemp."/".$name."/temp";
725 }
726 }
727 }
728 }
729 }
730
731 // For mycompany storage
732 $this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany");
733 $this->mycompany->multidir_temp = array($this->entity => $rootfortemp."/mycompany/temp");
734 // For backward compatibility
735 $this->mycompany->dir_output = $rootfordata."/mycompany";
736 $this->mycompany->dir_temp = $rootfortemp."/mycompany/temp";
737
738 // For admin storage
739 $this->admin->dir_output = $rootfordata.'/admin';
740 $this->admin->dir_temp = $rootfortemp.'/admin/temp';
741
742 // For user storage
743 $this->user->multidir_output = array($this->entity => $rootfordata."/users");
744 $this->user->multidir_temp = array($this->entity => $rootfortemp."/users/temp");
745 // For backward compatibility
746 $this->user->dir_output = $rootforuser."/users";
747 $this->user->dir_temp = $rootfortemp."/users/temp";
748
749 // For proposal storage
750 $this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
751 $this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp");
752 // For backward compatibility
753 $this->propal->dir_output = $rootfordata."/propale";
754 $this->propal->dir_temp = $rootfortemp."/propale/temp";
755
756 // For medias storage
757 $this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
758 $this->medias->multidir_temp = array($this->entity => $rootfortemp."/medias/temp");
759
760 // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
761
762 // Module supplier is on
763 if (isModEnabled('fournisseur')) {
764 $this->fournisseur->commande = new stdClass();
765 $this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
766 $this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
767 $this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
768 $this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
769
770 $this->fournisseur->facture = new stdClass();
771 $this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
772 $this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
773 $this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
774 $this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
775
776 $this->supplier_proposal = new stdClass();
777 $this->supplier_proposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal");
778 $this->supplier_proposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp");
779 $this->supplier_proposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility
780 $this->supplier_proposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility
781
782 $this->fournisseur->payment = new stdClass();
783 $this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
784 $this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp");
785 $this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
786 $this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
787
788 // To prepare split of module supplier into module 'supplier' + 'supplier_order' + 'supplier_invoice'
789 if (!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) { // By default, if module supplier is on, and we don't use yet the new modules, we set artificially the module properties
790 $this->supplier_order = new stdClass();
791 $this->supplier_order->enabled = 1;
792 $this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
793 $this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
794 $this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
795 $this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
796
797 $this->supplier_invoice = new stdClass();
798 $this->supplier_invoice->enabled = 1;
799 $this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
800 $this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
801 $this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
802 $this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
803 }
804 }
805
806 // Module compta
807 $this->compta->payment = new stdClass();
808 $this->compta->payment->dir_output = $rootfordata."/compta/payment";
809 $this->compta->payment->dir_temp = $rootfortemp."/compta/payment/temp";
810
811 // Module product/service
812 $this->product->multidir_output = array($this->entity => $rootfordata."/produit");
813 $this->product->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");
814 $this->service->multidir_output = array($this->entity => $rootfordata."/produit");
815 $this->service->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");
816 // For backward compatibility
817 $this->product->dir_output = $rootfordata."/produit";
818 $this->product->dir_temp = $rootfortemp."/produit/temp";
819 $this->service->dir_output = $rootfordata."/produit";
820 $this->service->dir_temp = $rootfortemp."/produit/temp";
821
822 // Module productbatch
823 $this->productbatch->multidir_output = array($this->entity => $rootfordata."/productlot");
824 $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/productlot/temp");
825
826 // Module contrat
827 $this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
828 $this->contrat->multidir_temp = array($this->entity => $rootfortemp."/contract/temp");
829 // For backward compatibility
830 $this->contrat->dir_output = $rootfordata."/contract";
831 $this->contrat->dir_temp = $rootfortemp."/contract/temp";
832
833 // Module bank
834 $this->bank->multidir_output = array($this->entity => $rootfordata."/bank");
835 $this->bank->multidir_temp = array($this->entity => $rootfortemp."/bank/temp");
836 // For backward compatibility
837 $this->bank->dir_output = $rootfordata."/bank";
838 $this->bank->dir_temp = $rootfortemp."/bank/temp";
839
840 // Set some default values
841 //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
842 $this->global->MAIN_MAIL_USE_MULTI_PART = 1;
843
844 // societe
845 if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) {
846 $this->global->SOCIETE_CODECLIENT_ADDON = "mod_codeclient_leopard";
847 }
848 if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) {
849 $this->global->SOCIETE_CODECOMPTA_ADDON = "mod_codecompta_panicum";
850 }
851
852 if (empty($this->global->CHEQUERECEIPTS_ADDON)) {
853 $this->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipt_mint';
854 }
855 if (empty($this->global->TICKET_ADDON)) {
856 $this->global->TICKET_ADDON = 'mod_ticket_simple';
857 }
858
859 // Security
860 if (empty($this->global->USER_PASSWORD_GENERATED)) {
861 $this->global->USER_PASSWORD_GENERATED = 'standard'; // Default password generator
862 }
863 if (empty($this->global->MAIN_UMASK)) {
864 $this->global->MAIN_UMASK = '0660'; // Default mask
865 } else {
866 // We remove the execute bits on the file umask
867 $tmpumask = (octdec(getDolGlobalString('MAIN_UMASK')) & 0666);
868 $tmpumask = decoct($tmpumask);
869 if (!preg_match('/^0/', $tmpumask)) { // Convert string '123' into octal representation '0123'
870 $tmpumask = '0'.$tmpumask;
871 }
872 if (empty($tmpumask)) { // when $tmpmask is null, '', or '0'
873 $tmpumask = '0664';
874 }
875 $this->global->MAIN_UMASK = $tmpumask;
876 }
877
878 // conf->use_javascript_ajax
879 $this->use_javascript_ajax = 1;
880 if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) {
881 $this->use_javascript_ajax = (int) !$this->global->MAIN_DISABLE_JAVASCRIPT;
882 }
883 // If no javascript_ajax, Ajax features are disabled.
884 if (empty($this->use_javascript_ajax)) {
885 unset($this->global->PRODUIT_USE_SEARCH_TO_SELECT);
886 unset($this->global->COMPANY_USE_SEARCH_TO_SELECT);
887 unset($this->global->CONTACT_USE_SEARCH_TO_SELECT);
888 unset($this->global->PROJECT_USE_SEARCH_TO_SELECT);
889 }
890
891 if (isModEnabled('productbatch')) {
892 // If module lot/serial enabled, we force the inc/dec mode to STOCK_CALCULATE_ON_SHIPMENT_CLOSE and STOCK_CALCULATE_ON_RECEPTION_CLOSE
893 $this->global->STOCK_CALCULATE_ON_BILL = 0;
894 $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
895 if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) {
896 $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1;
897 }
898 if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
899 $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
900 }
901 $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
902 $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
903 if (!isModEnabled('reception')) {
904 $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
905 } else {
906 if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) {
907 $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1;
908 }
909 if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
910 $this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
911 }
912 }
913 }
914
915 if (!isset($this->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT)) {
916 $this->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT = 1;
917 }
918
919 // conf->currency
920 if (empty($this->global->MAIN_MONNAIE)) {
921 $this->global->MAIN_MONNAIE = 'EUR';
922 }
923 $this->currency = $this->global->MAIN_MONNAIE;
924
925 if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) {
926 $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
927 }
928
929 // conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
930 if (empty($this->global->ACCOUNTING_MODE)) {
931 $this->global->ACCOUNTING_MODE = 'RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
932 }
933
934 if (!isset($this->global->MAIN_ENABLE_AJAX_TOOLTIP)) {
935 $this->global->MAIN_ENABLE_AJAX_TOOLTIP = 0; // Not enabled by default (still trouble of persistent tooltip)
936 }
937
938 // By default, suppliers objects can be linked to all projects
939 if (!isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) {
940 $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
941 }
942
943 // By default we enable feature to bill time spent
944 if (!isset($this->global->PROJECT_BILL_TIME_SPENT)) {
945 $this->global->PROJECT_BILL_TIME_SPENT = 1;
946 }
947
948 // MAIN_HTML_TITLE
949 if (!isset($this->global->MAIN_HTML_TITLE)) {
950 $this->global->MAIN_HTML_TITLE = 'thirdpartynameonly,contactnameonly,projectnameonly';
951 }
952
953 // conf->liste_limit = constant to limit size of lists
954 // This value can be overwritten by user choice in main.inc.php
955 $this->liste_limit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT', 15);
956 if ((int) $this->liste_limit <= 0) {
957 // Mode automatic. Similar code than into main.inc.php
958 $this->liste_limit = 15;
959 if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 700) {
960 $this->liste_limit = 8;
961 } elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) {
962 $this->liste_limit = 10;
963 } elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] > 1130) {
964 $this->liste_limit = 20;
965 }
966 }
967
968 // conf->main_checkbox_left_column = constant to set checkbox list to left
969 if (!isset($this->main_checkbox_left_column)) {
970 $this->main_checkbox_left_column = getDolGlobalInt("MAIN_CHECKBOX_LEFT_COLUMN");
971 }
972
973 // Set PRODUIT_LIMIT_SIZE if never defined
974 if (!isset($this->global->PRODUIT_LIMIT_SIZE)) {
975 $this->global->PRODUIT_LIMIT_SIZE = 1000;
976 }
977
978 // Set PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE, may be modified later according to browser
979 $this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = getDolGlobalInt('PRODUIT_DESC_IN_FORM');
980
981 // conf->theme et $this->css
982 if (empty($this->global->MAIN_THEME)) {
983 $this->global->MAIN_THEME = "eldy";
984 }
985 if (!empty($this->global->MAIN_FORCETHEME)) {
986 $this->global->MAIN_THEME = $this->global->MAIN_FORCETHEME;
987 }
988 $this->theme = $this->global->MAIN_THEME;
989 $this->css = "/theme/".$this->theme."/style.css.php";
990
991 // conf->email_from = email by default to send Dolibarr automatic emails
992 $this->email_from = "robot@example.com";
993 if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) {
994 $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
995 }
996
997 // conf->notification->email_from = email by default to send Dolibarr notifications
998 if (isModEnabled('notification')) {
999 $this->notification->email_from = $this->email_from;
1000 if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) {
1001 $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM;
1002 }
1003 }
1004
1005 if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
1006 $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1;
1007 }
1008
1009 if (!isset($this->global->MAIN_FIX_FOR_BUGGED_MTA)) {
1010 $this->global->MAIN_FIX_FOR_BUGGED_MTA = 1;
1011 }
1012
1013 // Format for date (used by default when not found or not searched in lang)
1014 $this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
1015 $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags
1016 $this->format_hour_short = "%H:%M";
1017 $this->format_hour_short_duration = "%H:%M";
1018 $this->format_date_text_short = "%d %b %Y";
1019 $this->format_date_text = "%d %B %Y";
1020 $this->format_date_hour_short = "%d/%m/%Y %H:%M";
1021 $this->format_date_hour_sec_short = "%d/%m/%Y %H:%M:%S";
1022 $this->format_date_hour_text_short = "%d %b %Y %H:%M";
1023 $this->format_date_hour_text = "%d %B %Y %H:%M";
1024
1025 // Duration of workday
1026 if (!isset($this->global->MAIN_DURATION_OF_WORKDAY)) {
1027 $this->global->MAIN_DURATION_OF_WORKDAY = 86400;
1028 }
1029
1030 // Limites decimales si non definie (peuvent etre egale a 0)
1031 if (!isset($this->global->MAIN_MAX_DECIMALS_UNIT)) {
1032 $this->global->MAIN_MAX_DECIMALS_UNIT = 5;
1033 }
1034 if (!isset($this->global->MAIN_MAX_DECIMALS_TOT)) {
1035 $this->global->MAIN_MAX_DECIMALS_TOT = 2;
1036 }
1037 if (!isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) {
1038 $this->global->MAIN_MAX_DECIMALS_SHOWN = 8;
1039 }
1040
1041 // Default pdf option
1042 if (!isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) {
1043 $this->global->MAIN_PDF_DASH_BETWEEN_LINES = 1; // use dash between lines
1044 }
1045 if (!isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
1046 $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1; // allow html content into free footer text
1047 }
1048 if (!isset($this->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING)) {
1049 $this->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING = 1;
1050 }
1051
1052 // Default max file size for upload (deprecated)
1053 //$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024);
1054
1055 // By default, we propagate contacts
1056 if (!isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) {
1057 $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN = '*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
1058 }
1059
1060 // By default, we do not use the zip town table but the table of third parties
1061 if (!isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) {
1062 $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY = 0;
1063 }
1064
1065 // By default, we open card if one found
1066 if (!isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) {
1067 $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1;
1068 }
1069
1070 // By default, we show state code in combo list
1071 if (!isset($this->global->MAIN_SHOW_STATE_CODE)) {
1072 $this->global->MAIN_SHOW_STATE_CODE = 1;
1073 }
1074
1075 // By default, we show state code in combo list
1076 if (!isset($this->global->MULTICURRENCY_USE_ORIGIN_TX)) {
1077 $this->global->MULTICURRENCY_USE_ORIGIN_TX = 1;
1078 }
1079
1080 // By default, use an enclosure " for field with CRL or LF into content, + we also remove also CRL/LF chars.
1081 if (!isset($this->global->USE_STRICT_CSV_RULES)) {
1082 $this->global->USE_STRICT_CSV_RULES = 2;
1083 }
1084
1085 // By default, accept to create members with no login
1086 if (!isset($this->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1087 $this->global->ADHERENT_LOGIN_NOT_REQUIRED = 1;
1088 }
1089
1090 // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
1091 if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
1092 $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
1093 }
1094
1095 // Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
1096 if (!isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) {
1097 $this->global->MAIN_MODULES_FOR_EXTERNAL = 'user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,reception,agenda,resource,adherent,blockedlog,ticket'; // '' means 'all'. Note that contact is added here as it should be a module later.
1098 }
1099 if (!empty($this->modules_parts['moduleforexternal'])) { // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
1100 foreach ($this->modules_parts['moduleforexternal'] as $key => $value) {
1101 $this->global->MAIN_MODULES_FOR_EXTERNAL .= ",".$key;
1102 }
1103 }
1104 //$this->global->MAIN_MODULES_FOR_EXTERNAL .= ",ecm";
1105
1106 // Enable select2
1107 if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') {
1108 $this->global->MAIN_USE_JQUERY_MULTISELECT = 'select2';
1109 }
1110
1111 // Timeouts
1112 if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) {
1113 $this->global->MAIN_USE_CONNECT_TIMEOUT = 10;
1114 }
1115 if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) {
1116 $this->global->MAIN_USE_RESPONSE_TIMEOUT = 30;
1117 }
1118
1119 // Set default variable to calculate VAT as if option tax_mode was 0 (standard)
1120 if (empty($this->global->TAX_MODE_SELL_PRODUCT)) {
1121 $this->global->TAX_MODE_SELL_PRODUCT = 'invoice';
1122 }
1123 if (empty($this->global->TAX_MODE_BUY_PRODUCT)) {
1124 $this->global->TAX_MODE_BUY_PRODUCT = 'invoice';
1125 }
1126 if (empty($this->global->TAX_MODE_SELL_SERVICE)) {
1127 $this->global->TAX_MODE_SELL_SERVICE = 'payment';
1128 }
1129 if (empty($this->global->TAX_MODE_BUY_SERVICE)) {
1130 $this->global->TAX_MODE_BUY_SERVICE = 'payment';
1131 }
1132
1133 // Delay before warnings
1134 // Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
1135 if (isset($this->agenda)) {
1136 $this->adherent->subscription = new stdClass();
1137 $this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? (int) $this->global->MAIN_DELAY_MEMBERS : 0) * 86400;
1138 }
1139 if (isset($this->agenda)) {
1140 $this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? (int) $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 86400;
1141 }
1142 if (isset($this->projet)) {
1143 $this->projet->warning_delay = (getDolGlobalInt('MAIN_DELAY_PROJECT_TO_CLOSE', 7) * 86400);
1144 $this->projet->task = new StdClass();
1145 $this->projet->task->warning_delay = (getDolGlobalInt('MAIN_DELAY_TASKS_TODO', 7) * 86400);
1146 }
1147
1148 if (isset($this->commande)) {
1149 $this->commande->client = new stdClass();
1150 $this->commande->fournisseur = new stdClass();
1151 $this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? (int) $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 86400;
1152 $this->commande->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? (int) $this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 86400;
1153 }
1154 if (isset($this->propal)) {
1155 $this->propal->cloture = new stdClass();
1156 $this->propal->facturation = new stdClass();
1157 $this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 86400;
1158 $this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 86400;
1159 }
1160 if (isset($this->facture)) {
1161 $this->facture->client = new stdClass();
1162 $this->facture->fournisseur = new stdClass();
1163 $this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? (int) $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 86400;
1164 $this->facture->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? (int) $this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 86400;
1165 }
1166 if (isset($this->contrat)) {
1167 $this->contrat->services = new stdClass();
1168 $this->contrat->services->inactifs = new stdClass();
1169 $this->contrat->services->expires = new stdClass();
1170 $this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? (int) $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 86400;
1171 $this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? (int) $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400;
1172 }
1173 if (isset($this->commande)) {
1174 $this->bank->rappro = new stdClass();
1175 $this->bank->cheque = new stdClass();
1176 $this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? (int) $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400;
1177 $this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? (int) $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400;
1178 }
1179 if (isset($this->expensereport)) {
1180 $this->expensereport->approve = new stdClass();
1181 $this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 86400;
1182 $this->expensereport->payment = new stdClass();
1183 $this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 86400;
1184 }
1185 if (isset($this->holiday)) {
1186 $this->holiday->approve = new stdClass();
1187 $this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? (int) $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400;
1188 }
1189
1190 if ((!empty($this->global->PRODUIT_MULTIPRICES) || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) {
1191 $this->global->PRODUIT_MULTIPRICES_LIMIT = 5;
1192 }
1193
1194 if (!isset($this->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1195 $this->global->MAIN_CHECKBOX_LEFT_COLUMN = 1;
1196 }
1197
1198 // For modules that want to disable top or left menu
1199 if (!empty($this->global->MAIN_HIDE_TOP_MENU)) {
1200 $this->dol_hide_topmenu = $this->global->MAIN_HIDE_TOP_MENU;
1201 }
1202 if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) {
1203 $this->dol_hide_leftmenu = $this->global->MAIN_HIDE_LEFT_MENU;
1204 }
1205
1206 if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) {
1207 $this->global->MAIN_SIZE_SHORTLIST_LIMIT = 3;
1208 }
1209
1210 // Save inconsistent option
1211 if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (!isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO')) {
1212 $this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
1213 }
1214
1215 if (!isset($this->global->MAIN_JS_GRAPH)) {
1216 $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
1217 }
1218
1219 if (!isset($this->global->THEME_ELDY_USEBORDERONTABLE)) {
1220 $this->global->THEME_ELDY_USEBORDERONTABLE = 1;
1221 }
1222
1223 if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) {
1224 $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
1225 }
1226 if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) {
1227 $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
1228 }
1229
1230 // Enable by default the CSRF protection by token.
1231 if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
1232 // Value 1 makes CSRF check for all POST parameters only
1233 // Value 2 makes also CSRF check for GET requests with action = a sensitive requests like action=del, action=remove...
1234 // Value 3 makes also CSRF check for all GET requests with a param action or massaction (except some non sensitive values)
1235 $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 2; // TODO Switch value to 3
1236 // Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended)
1237 }
1238
1239 if (!isset($this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA)) {
1240 $this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA = 1;
1241 }
1242
1243 if (!isset($this->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
1244 $this->global->MAIL_SMTP_USE_FROM_FOR_HELO = 2; // Use the domain in $dolibarr_main_url_root (mydomain.com)
1245 }
1246
1247 if (!defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
1248 if (defined('MAIN_ANTIVIRUS_COMMAND')) {
1249 $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND');
1250 }
1251 if (defined('MAIN_ANTIVIRUS_PARAM')) {
1252 $this->global->MAIN_ANTIVIRUS_PARAM = constant('MAIN_ANTIVIRUS_PARAM');
1253 }
1254 }
1255
1256 // For backward compatibility
1257 if (!empty($this->global->LDAP_SYNCHRO_ACTIVE)) {
1258 if ($this->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
1259 $this->global->LDAP_SYNCHRO_ACTIVE = 1;
1260 } elseif ($this->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
1261 $this->global->LDAP_SYNCHRO_ACTIVE = 2;
1262 }
1263 }
1264 // For backward compatibility
1265 if (!empty($this->global->LDAP_MEMBER_ACTIVE) && $this->global->LDAP_MEMBER_ACTIVE == 'ldap2dolibarr') {
1266 $this->global->LDAP_MEMBER_ACTIVE = 2;
1267 }
1268 // For backward compatibility
1269 if (!empty($this->global->LDAP_MEMBER_TYPE_ACTIVE) && $this->global->LDAP_MEMBER_TYPE_ACTIVE == 'ldap2dolibarr') {
1270 $this->global->LDAP_MEMBER_TYPE_ACTIVE = 2;
1271 }
1272
1273 if (!empty($this->global->MAIN_TZUSERINPUTKEY)) {
1274 $this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel'
1275 }
1276
1277 if (!empty($this->global->PRODUIT_AUTOFILL_DESC)) {
1278 $this->global->MAIN_NO_CONCAT_DESCRIPTION = 1;
1279 } else {
1280 unset($this->global->MAIN_NO_CONCAT_DESCRIPTION);
1281 }
1282
1283
1284 // Simple deprecation management. We do not use DolDeprecationHandlet for $conf.
1285
1286 // product is new use
1287 if (isset($this->product)) {
1288 // For backward compatibility
1289 $this->produit = $this->product;
1290 }
1291 // invoice is new use, facture is old use still initialised
1292 if (isset($this->facture)) {
1293 $this->invoice = $this->facture;
1294 }
1295 // order is new use, commande is old use still initialised
1296 if (isset($this->commande)) {
1297 $this->order = $this->commande;
1298 }
1299 // contract is new use, contrat is old use still initialised
1300 if (isset($this->contrat)) {
1301 $this->contract = $this->contrat;
1302 }
1303 // category is new use, categorie is old use still initialised
1304 if (isset($this->categorie)) {
1305 $this->category = $this->categorie;
1306 }
1307 // project is new use, projet is old use still initialised
1308 if (isset($this->projet) && !isset($this->project)) {
1309 $this->project = $this->projet;
1310 }
1311 // member is new use, adherent is old use still initialised
1312 if (isset($this->adherent) && !isset($this->member)) {
1313 $this->member = $this->adherent;
1314 }
1315
1316 // Object $mc
1317 if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) {
1318 if (is_object($mc)) {
1319 $mc->setValues($this);
1320 }
1321 }
1322
1323 if (isModEnabled('syslog')) {
1324 // We init log handlers
1325 if (!empty($this->global->SYSLOG_HANDLERS)) {
1326 $handlers = json_decode($this->global->SYSLOG_HANDLERS);
1327 } else {
1328 $handlers = array();
1329 }
1330 foreach ($handlers as $handler) {
1331 $handler_file_found = '';
1332 $dirsyslogs = array('/core/modules/syslog/');
1333 if (!empty($this->modules_parts['syslog']) && is_array($this->modules_parts['syslog'])) {
1334 $dirsyslogs = array_merge($dirsyslogs, $this->modules_parts['syslog']);
1335 }
1336 foreach ($dirsyslogs as $reldir) {
1337 $dir = dol_buildpath($reldir, 0);
1338 $newdir = dol_osencode($dir);
1339 if (is_dir($newdir)) {
1340 $file = $newdir.$handler.'.php';
1341 if (file_exists($file)) {
1342 $handler_file_found = $file;
1343 break;
1344 }
1345 }
1346 }
1347
1348 if (empty($handler_file_found)) {
1349 // If log handler has been removed of is badly setup, we must be able to continue code.
1350 //throw new Exception('Missing log handler file '.$handler.'.php');
1351 continue;
1352 }
1353
1354 require_once $handler_file_found;
1355 $loghandlerinstance = new $handler();
1356 if (!$loghandlerinstance instanceof LogHandler) {
1357 throw new Exception('Log handler does not extend LogHandler');
1358 }
1359
1360 if (empty($this->loghandlers[$handler])) {
1361 $this->loghandlers[$handler] = $loghandlerinstance;
1362 }
1363 }
1364 }
1365 }
1366
1367 // Overwrite database values from conf into the conf.php file.
1368 if (!empty($this->file->mailing_limit_sendbyweb)) {
1369 $this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
1370 }
1371 if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { // Limit by web can't be 0
1372 $this->global->MAILING_LIMIT_SENDBYWEB = 25;
1373 }
1374 if (!empty($this->file->mailing_limit_sendbycli)) {
1375 $this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
1376 }
1377 if (!empty($this->file->mailing_limit_sendbyday)) {
1378 $this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday;
1379 }
1380
1381 return 0;
1382 }
1383}
Class to stock current configuration.
setValues($db)
Load setup values into conf object (read llx_const) Note that this->db->xxx, this->file->xxx have bee...
$expedition_bon
To store module status of special module names.
$mycompany
To store some setup of generic modules.
__construct()
Constructor.
setEntityValues($db, $entity)
Load setup values into conf object (read llx_const) for a specified entity Note that this->db->xxx,...
Parent class for log handlers.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db user
Active Directory does not allow anonymous connections.
Definition repair.php:153
dolDecrypt($chain, $key='')
Decode a string with a symmetric encryption.