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