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