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