dolibarr 19.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 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
32class Conf extends stdClass
33{
37 public $file;
38
42 public $db;
43
45 public $global;
47 public $browser;
48
50 public $mycompany;
51 public $admin;
52 public $medias;
55
58 public $delivery_note;
59
60
66 public $currency;
67
69 public $theme; // Contains current theme ("eldy", "auguria", ...)
70 public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
71
72 public $email_from;
73
76 // List of activated modules
77 public $modules;
78 public $modules_parts;
79
80 // An array to store cache results ->cache['nameofcache']=...
81 public $cache;
82
86 public $headerdone;
87
91 public $logbuffer = array();
92
96 public $loghandlers = array();
97
99 public $entity = 1;
101 public $entities = array();
102
103 public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url
104 public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url
105 public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone
106 public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
107 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
108
109 public $format_date_short; // Format of day with PHP/C tags (strftime functions)
110 public $format_date_short_java; // Format of day with Java tags
111 public $format_hour_short;
112 public $format_hour_short_duration;
113 public $format_date_text_short;
114 public $format_date_text;
115 public $format_date_hour_short;
116 public $format_date_hour_sec_short;
117 public $format_date_hour_text_short;
118 public $format_date_hour_text;
119
120 public $liste_limit;
121
122 public $tzuserinputkey = 'tzserver'; // Use 'tzuserrel' to always store date in GMT and show date in time zone of user.
123
124
125 // TODO Remove this part.
126 public $fournisseur;
127 public $product;
131 public $produit;
132 public $service;
136 public $contrat;
137 public $contract;
138 public $actions;
139 public $agenda;
140 public $commande;
141 public $propal;
142 public $order;
146 public $facture;
147 public $invoice;
148 public $user;
152 public $adherent;
153 public $member;
154 public $bank;
155 public $notification;
156 public $expensereport;
157 public $productbatch;
161 public $projet;
162 public $project;
163 public $supplier_proposal;
164 public $supplier_order;
165 public $supplier_invoice;
166 public $category;
167
168
172 public function __construct()
173 {
174 // Properly declare multi-modules objects.
175 $this->file = new stdClass();
176 $this->db = new stdClass();
178 $this->file->character_set_client = 'UTF-8'; // UTF-8, ISO-8859-1
179
180 // Common objects that are not modules
181 $this->mycompany = new stdClass();
182 $this->admin = new stdClass();
183 $this->medias = new stdClass();
184 $this->global = new stdClass();
185
186 // Common objects that are not modules and set by the main and not into the this->setValues()
187 $this->browser = new stdClass();
188
189 // Common arrays
190 $this->cache = array();
191 $this->modules = array();
192 $this->modules_parts = array(
193 'css' => array(),
194 'js' => array(),
195 'tabs' => array(),
196 'triggers' => array(),
197 'login' => array(),
198 'substitutions' => array(),
199 'menus' => array(),
200 'theme' => array(),
201 'sms' => array(),
202 'tpl' => array(),
203 'barcode' => array(),
204 'models' => array(),
205 'societe' => array(),
206 'member' => array(),
207 'hooks' => array(),
208 'dir' => array(),
209 'syslog' => array()
210 );
211
212 // First level object that are modules.
213 // TODO Remove this part.
214 $this->multicompany = new stdClass();
215 $this->fournisseur = new stdClass();
216 $this->product = new stdClass();
217 $this->service = new stdClass();
218 $this->contrat = new stdClass();
219 $this->actions = new stdClass();
220 $this->agenda = new stdClass();
221 $this->commande = new stdClass();
222 $this->propal = new stdClass();
223 $this->facture = new stdClass();
224 $this->user = new stdClass();
225 $this->adherent = new stdClass();
226 $this->bank = new stdClass();
227 $this->notification = new stdClass();
228 $this->expensereport = new stdClass();
229 $this->productbatch = new stdClass();
230 }
231
240 public function setEntityValues($db, $entity)
241 {
242 if ($this->entity != $entity) {
243 // If we ask to reload setup for a new entity
244 $this->entity = $entity;
245 return $this->setValues($db);
246 }
247
248 return 0;
249 }
250
258 public function setValues($db)
259 {
260 dol_syslog(get_class($this)."::setValues");
261
262 // Unset all old modules values
263 if (!empty($this->modules)) {
264 foreach ($this->modules as $m) {
265 if (isset($this->$m)) {
266 unset($this->$m);
267 }
268 }
269 }
270
271 // Common objects that are not modules
272 $this->mycompany = new stdClass();
273 $this->admin = new stdClass();
274 $this->medias = new stdClass();
275 $this->global = new stdClass();
276
277 // Common objects that are not modules and set by the main and not into the this->setValues()
278 //$this->browser = new stdClass(); // This is set by main and not into this setValues(), so we keep it intact.
279
280 // First level object
281 // TODO Remove this part.
282 $this->fournisseur = new stdClass();
283 $this->product = new stdClass();
284 $this->service = new stdClass();
285 $this->contrat = new stdClass();
286 $this->actions = new stdClass();
287 $this->agenda = new stdClass();
288 $this->commande = new stdClass();
289 $this->propal = new stdClass();
290 $this->facture = new stdClass();
291 $this->user = new stdClass();
292 $this->adherent = new stdClass();
293 $this->bank = new stdClass();
294 $this->notification = new stdClass();
295 $this->expensereport = new stdClass();
296 $this->productbatch = new stdClass();
297
298 // Common arrays
299 $this->cache = array();
300 $this->modules = array();
301 $this->modules_parts = array(
302 'css' => array(),
303 'js' => array(),
304 'tabs' => array(),
305 'triggers' => array(),
306 'login' => array(),
307 'substitutions' => array(),
308 'menus' => array(),
309 'theme' => array(),
310 'sms' => array(),
311 'tpl' => array(),
312 'barcode' => array(),
313 'models' => array(),
314 'societe' => array(),
315 'member' => array(),
316 'hooks' => array(),
317 'dir' => array(),
318 'syslog' => array(),
319 );
320
321 if (!is_null($db) && is_object($db)) {
322 include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
323
324 // Define all global constants into $this->global->key=value
325 $sql = "SELECT ".$db->decrypt('name')." as name,";
326 $sql .= " ".$db->decrypt('value')." as value, entity";
327 $sql .= " FROM ".$db->prefix()."const";
328 $sql .= " WHERE entity IN (0,".$this->entity.")";
329 $sql .= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
330
331 $resql = $db->query($sql);
332 if ($resql) {
333 $i = 0;
334 $numr = $db->num_rows($resql);
335 while ($i < $numr) {
336 $objp = $db->fetch_object($resql);
337 $key = $objp->name;
338 $value = $objp->value;
339 if ($key) {
340 // Allow constants values to be overridden by environment variables
341 if (isset($_SERVER['DOLIBARR_'.$key])) {
342 $value = $_SERVER['DOLIBARR_'.$key];
343 } elseif (isset($_ENV['DOLIBARR_'.$key])) {
344 $value = $_ENV['DOLIBARR_'.$key];
345 }
346
347 $this->global->$key = dolDecrypt($value); // decrypt data excrypted with dolibarr_set_const($db, $name, $value)
348
349 if ($value && strpos($key, 'MAIN_MODULE_') === 0) {
350 $reg = array();
351 // If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
352 if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) {
353 $partname = 'tabs';
354 $params = explode(':', $value, 2);
355 if (!is_array($this->modules_parts[$partname])) {
356 $this->modules_parts[$partname] = array();
357 }
358 $this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array
359 } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
360 // If this is constant for all generic part activated by a module. It initializes
361 // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
362 // modules_parts['models'], modules_parts['theme']
363 // modules_parts['sms'],
364 // modules_parts['css'], modules_parts['js'],...
365
366 $modulename = strtolower($reg[1]);
367 $partname = strtolower($reg[2]);
368 if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
369 $this->modules_parts[$partname] = array();
370 }
371
372 $arrValue = json_decode($value, true);
373
374 if (is_array($arrValue)) {
375 $newvalue = $arrValue;
376 } elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) {
377 $newvalue = '/'.$modulename.'/core/'.$partname.'/';
378 } elseif (in_array($partname, array('models', 'theme'))) {
379 $newvalue = '/'.$modulename.'/';
380 } elseif ($value == 1) {
381 $newvalue = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
382 } else { // $partname can be any other value like 'sms', ...
383 $newvalue = $value;
384 }
385
386 if (!empty($newvalue)) {
387 $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $newvalue)); // $value may be a string or an array
388 }
389 } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
390 // If this is a module constant (must be at end)
391 $modulename = strtolower($reg[1]);
392 if ($modulename == 'propale') {
393 $modulename = 'propal';
394 }
395 if ($modulename == 'supplierproposal') {
396 $modulename = 'supplier_proposal';
397 }
398 $this->modules[$modulename] = $modulename; // Add this module in list of enabled modules
399
400 // deprecated in php 8.2
401 //if (version_compare(phpversion(), '8.2') < 0) {
402 if (!isset($this->$modulename) || !is_object($this->$modulename)) {
403 $this->$modulename = new stdClass(); // We need this to use the ->enabled and the ->multidir, ->dir...
404 }
405 $this->$modulename->enabled = true; // TODO Remove this
406 //}
407 }
408 }
409 }
410 $i++;
411 }
412
413 $db->free($resql);
414 }
415
416 // Include other local file xxx/zzz_consts.php to overwrite some variables
417 if (!empty($this->global->LOCAL_CONSTS_FILES)) {
418 $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
419 foreach ($filesList as $file) {
420 $file = dol_sanitizeFileName($file);
421 dol_include_once($file."/".$file."_consts.php"); // This file can run code like setting $this->global->XXX vars.
422 }
423 }
424
425 //var_dump($this->modules);
426 //var_dump($this->modules_parts['theme']);
427
428 // If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
429 // In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
430 //$this->global->MAIN_SERVER_TZ='Europe/Paris';
431 if (!empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') {
432 try {
433 date_default_timezone_set($this->global->MAIN_SERVER_TZ);
434 } catch (Exception $e) {
435 dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR);
436 }
437 }
438
439 // Object $mc
440 if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) {
441 global $mc;
442 $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
443 if ($ret && class_exists('ActionsMulticompany')) {
444 $mc = new ActionsMulticompany($db);
445 }
446 }
447
448 // Clean some variables
449 if (empty($this->global->MAIN_MENU_STANDARD)) {
450 $this->global->MAIN_MENU_STANDARD = "eldy_menu.php";
451 }
452 if (empty($this->global->MAIN_MENUFRONT_STANDARD)) {
453 $this->global->MAIN_MENUFRONT_STANDARD = "eldy_menu.php";
454 }
455 if (empty($this->global->MAIN_MENU_SMARTPHONE)) {
456 $this->global->MAIN_MENU_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
457 }
458 if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) {
459 $this->global->MAIN_MENUFRONT_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
460 }
461 if (!isset($this->global->FACTURE_TVAOPTION)) {
462 $this->global->FACTURE_TVAOPTION = 1;
463 }
464
465 // Variable globales LDAP
466 if (empty($this->global->LDAP_FIELD_FULLNAME)) {
467 $this->global->LDAP_FIELD_FULLNAME = '';
468 }
469 if (!isset($this->global->LDAP_KEY_USERS)) {
470 $this->global->LDAP_KEY_USERS = $this->global->LDAP_FIELD_FULLNAME;
471 }
472 if (!isset($this->global->LDAP_KEY_GROUPS)) {
473 $this->global->LDAP_KEY_GROUPS = $this->global->LDAP_FIELD_FULLNAME;
474 }
475 if (!isset($this->global->LDAP_KEY_CONTACTS)) {
476 $this->global->LDAP_KEY_CONTACTS = $this->global->LDAP_FIELD_FULLNAME;
477 }
478 if (!isset($this->global->LDAP_KEY_MEMBERS)) {
479 $this->global->LDAP_KEY_MEMBERS = $this->global->LDAP_FIELD_FULLNAME;
480 }
481 if (!isset($this->global->LDAP_KEY_MEMBERS_TYPES)) {
482 $this->global->LDAP_KEY_MEMBERS_TYPES = $this->global->LDAP_FIELD_FULLNAME;
483 }
484
485 // Load translation object with current language
486 if (empty($this->global->MAIN_LANG_DEFAULT)) {
487 $this->global->MAIN_LANG_DEFAULT = "en_US";
488 }
489
490 $rootfordata = DOL_DATA_ROOT;
491 $rootforuser = DOL_DATA_ROOT;
492 // If multicompany module is enabled, we redefine the root of data
493 if (isModEnabled('multicompany') && !empty($this->entity) && $this->entity > 1) {
494 $rootfordata .= '/'.$this->entity;
495 }
496 // Set standard temporary folder name or global override
497 $rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR;
498
499 // Define default dir_output and dir_temp for directories of modules
500 foreach ($this->modules as $module) {
501 //var_dump($module);
502 // For multicompany sharings
503 $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
504 $this->$module->multidir_temp = array($this->entity => $rootfortemp."/".$module."/temp");
505 // For backward compatibility
506 $this->$module->dir_output = $rootfordata."/".$module;
507 $this->$module->dir_temp = $rootfortemp."/".$module."/temp";
508 }
509
510 // External modules storage
511 if (!empty($this->modules_parts['dir'])) {
512 foreach ($this->modules_parts['dir'] as $module => $dirs) {
513 if (!empty($this->$module->enabled)) {
514 foreach ($dirs as $type => $name) { // $type is 'output' or 'temp'
515 $multidirname = 'multidir_'.$type;
516 $dirname = 'dir_'.$type;
517
518 if ($type != 'temp') {
519 // For multicompany sharings
520 $this->$module->$multidirname = array($this->entity => $rootfordata."/".$name);
521
522 // For backward compatibility
523 $this->$module->$dirname = $rootfordata."/".$name;
524 } else {
525 // For multicompany sharings
526 $this->$module->$multidirname = array($this->entity => $rootfortemp."/".$name."/temp");
527
528 // For backward compatibility
529 $this->$module->$dirname = $rootfortemp."/".$name."/temp";
530 }
531 }
532 }
533 }
534 }
535
536 // For mycompany storage
537 $this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany");
538 $this->mycompany->multidir_temp = array($this->entity => $rootfortemp."/mycompany/temp");
539 // For backward compatibility
540 $this->mycompany->dir_output = $rootfordata."/mycompany";
541 $this->mycompany->dir_temp = $rootfortemp."/mycompany/temp";
542
543 // For admin storage
544 $this->admin->dir_output = $rootfordata.'/admin';
545 $this->admin->dir_temp = $rootfortemp.'/admin/temp';
546
547 // For user storage
548 $this->user->multidir_output = array($this->entity => $rootfordata."/users");
549 $this->user->multidir_temp = array($this->entity => $rootfortemp."/users/temp");
550 // For backward compatibility
551 $this->user->dir_output = $rootforuser."/users";
552 $this->user->dir_temp = $rootfortemp."/users/temp";
553
554 // For proposal storage
555 $this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
556 $this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp");
557 // For backward compatibility
558 $this->propal->dir_output = $rootfordata."/propale";
559 $this->propal->dir_temp = $rootfortemp."/propale/temp";
560
561 // For medias storage
562 $this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
563 $this->medias->multidir_temp = array($this->entity => $rootfortemp."/medias/temp");
564
565 // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
566
567 // Module fournisseur
568 if (!empty($this->fournisseur)) {
569 $this->fournisseur->commande = new stdClass();
570 $this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
571 $this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
572 $this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
573 $this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
574
575 $this->fournisseur->facture = new stdClass();
576 $this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
577 $this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
578 $this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
579 $this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
580
581 $this->supplier_proposal = new stdClass();
582 $this->supplier_proposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal");
583 $this->supplier_proposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp");
584 $this->supplier_proposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility
585 $this->supplier_proposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility
586
587 $this->fournisseur->payment = new stdClass();
588 $this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
589 $this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp");
590 $this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
591 $this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
592
593 // To prepare split of module fournisseur into module 'fournisseur' + supplier_order + supplier_invoice
594 if (!empty($this->fournisseur->enabled) && empty($this->global->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
595 $this->supplier_order = new stdClass();
596 $this->supplier_order->enabled = 1;
597 $this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
598 $this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
599 $this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
600 $this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
601
602 $this->supplier_invoice = new stdClass();
603 $this->supplier_invoice->enabled = 1;
604 $this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
605 $this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
606 $this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
607 $this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
608 }
609 }
610
611 // Module product/service
612 $this->product->multidir_output = array($this->entity => $rootfordata."/produit");
613 $this->product->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");
614 $this->service->multidir_output = array($this->entity => $rootfordata."/produit");
615 $this->service->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");
616 // For backward compatibility
617 $this->product->dir_output = $rootfordata."/produit";
618 $this->product->dir_temp = $rootfortemp."/produit/temp";
619 $this->service->dir_output = $rootfordata."/produit";
620 $this->service->dir_temp = $rootfortemp."/produit/temp";
621
622 // Module productbatch
623 $this->productbatch->multidir_output = array($this->entity => $rootfordata."/productlot");
624 $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/productlot/temp");
625
626 // Module contrat
627 $this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
628 $this->contrat->multidir_temp = array($this->entity => $rootfortemp."/contract/temp");
629 // For backward compatibility
630 $this->contrat->dir_output = $rootfordata."/contract";
631 $this->contrat->dir_temp = $rootfortemp."/contract/temp";
632
633 // Module bank
634 $this->bank->multidir_output = array($this->entity => $rootfordata."/bank");
635 $this->bank->multidir_temp = array($this->entity => $rootfortemp."/bank/temp");
636 // For backward compatibility
637 $this->bank->dir_output = $rootfordata."/bank";
638 $this->bank->dir_temp = $rootfortemp."/bank/temp";
639
640 // Set some default values
641 //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
642 $this->global->MAIN_MAIL_USE_MULTI_PART = 1;
643
644 // societe
645 if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) {
646 $this->global->SOCIETE_CODECLIENT_ADDON = "mod_codeclient_leopard";
647 }
648 if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) {
649 $this->global->SOCIETE_CODECOMPTA_ADDON = "mod_codecompta_panicum";
650 }
651
652 if (empty($this->global->CHEQUERECEIPTS_ADDON)) {
653 $this->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipt_mint';
654 }
655 if (empty($this->global->TICKET_ADDON)) {
656 $this->global->TICKET_ADDON = 'mod_ticket_simple';
657 }
658
659 // Security
660 if (empty($this->global->USER_PASSWORD_GENERATED)) {
661 $this->global->USER_PASSWORD_GENERATED = 'standard'; // Default password generator
662 }
663 if (empty($this->global->MAIN_UMASK)) {
664 $this->global->MAIN_UMASK = '0660'; // Default mask
665 } else {
666 // We remove the execute bits on the file umask
667 $tmpumask = (octdec($this->global->MAIN_UMASK) & 0666);
668 $tmpumask = decoct($tmpumask);
669 if (!preg_match('/^0/', $tmpumask)) {
670 $tmpumask = '0'.$tmpumask;
671 }
672 if (empty($tmpumask) || $tmpumask === '0') {
673 $tmpumask = '0664';
674 }
675 $this->global->MAIN_UMASK = $tmpumask;
676 }
677
678 // conf->use_javascript_ajax
679 $this->use_javascript_ajax = 1;
680 if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) {
681 $this->use_javascript_ajax = !$this->global->MAIN_DISABLE_JAVASCRIPT;
682 }
683 // If no javascript_ajax, Ajax features are disabled.
684 if (empty($this->use_javascript_ajax)) {
685 unset($this->global->PRODUIT_USE_SEARCH_TO_SELECT);
686 unset($this->global->COMPANY_USE_SEARCH_TO_SELECT);
687 unset($this->global->CONTACT_USE_SEARCH_TO_SELECT);
688 unset($this->global->PROJECT_USE_SEARCH_TO_SELECT);
689 }
690
691 if (isModEnabled('productbatch')) {
692 // If module lot/serial enabled, we force the inc/dec mode to STOCK_CALCULATE_ON_SHIPMENT_CLOSE and STOCK_CALCULATE_ON_RECEPTION_CLOSE
693 $this->global->STOCK_CALCULATE_ON_BILL = 0;
694 $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
695 if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) {
696 $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1;
697 }
698 if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
699 $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
700 }
701 $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
702 $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
703 if (!isModEnabled('reception')) {
704 $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
705 } else {
706 if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) {
707 $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1;
708 }
709 if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
710 $this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
711 }
712 }
713 }
714
715 if (!isset($this->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT)) {
716 $this->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT = 1;
717 }
718
719 // conf->currency
720 if (empty($this->global->MAIN_MONNAIE)) {
721 $this->global->MAIN_MONNAIE = 'EUR';
722 }
723 $this->currency = $this->global->MAIN_MONNAIE;
724
725 if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) {
726 $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
727 }
728
729 // conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
730 if (empty($this->global->ACCOUNTING_MODE)) {
731 $this->global->ACCOUNTING_MODE = 'RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
732 }
733
734 if (!isset($this->global->MAIN_ENABLE_AJAX_TOOLTIP)) {
735 $this->global->MAIN_ENABLE_AJAX_TOOLTIP = 0; // Not enabled by default (still trouble of persistent tooltip)
736 }
737
738 // By default, suppliers objects can be linked to all projects
739 if (!isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) {
740 $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
741 }
742
743 // By default we enable feature to bill time spent
744 if (!isset($this->global->PROJECT_BILL_TIME_SPENT)) {
745 $this->global->PROJECT_BILL_TIME_SPENT = 1;
746 }
747
748 // MAIN_HTML_TITLE
749 if (!isset($this->global->MAIN_HTML_TITLE)) {
750 $this->global->MAIN_HTML_TITLE = 'noapp,thirdpartynameonly,contactnameonly,projectnameonly';
751 }
752
753 // conf->liste_limit = constante de taille maximale des listes
754 if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) {
755 $this->global->MAIN_SIZE_LISTE_LIMIT = 15;
756 }
757 $this->liste_limit = $this->global->MAIN_SIZE_LISTE_LIMIT;
758
759 // conf->product->limit_size = constante de taille maximale des select de produit
760 if (!isset($this->global->PRODUIT_LIMIT_SIZE)) {
761 $this->global->PRODUIT_LIMIT_SIZE = 1000;
762 }
763 $this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE;
764
765 // Set PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE, may be modified later according to browser
766 $this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = (isset($this->global->PRODUIT_DESC_IN_FORM) ? $this->global->PRODUIT_DESC_IN_FORM : 0);
767
768 // conf->theme et $this->css
769 if (empty($this->global->MAIN_THEME)) {
770 $this->global->MAIN_THEME = "eldy";
771 }
772 if (!empty($this->global->MAIN_FORCETHEME)) {
773 $this->global->MAIN_THEME = $this->global->MAIN_FORCETHEME;
774 }
775 $this->theme = $this->global->MAIN_THEME;
776 $this->css = "/theme/".$this->theme."/style.css.php";
777
778 // conf->email_from = email by default to send Dolibarr automatic emails
779 $this->email_from = "robot@example.com";
780 if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) {
781 $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
782 }
783
784 // conf->notification->email_from = email by default to send Dolibarr notifications
785 if (isModEnabled('notification')) {
786 $this->notification->email_from = $this->email_from;
787 if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) {
788 $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM;
789 }
790 }
791
792 if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
793 $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1;
794 }
795
796 if (!isset($this->global->MAIN_FIX_FOR_BUGGED_MTA)) {
797 $this->global->MAIN_FIX_FOR_BUGGED_MTA = 1;
798 }
799
800 // Format for date (used by default when not found or not searched in lang)
801 $this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
802 $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags
803 $this->format_hour_short = "%H:%M";
804 $this->format_hour_short_duration = "%H:%M";
805 $this->format_date_text_short = "%d %b %Y";
806 $this->format_date_text = "%d %B %Y";
807 $this->format_date_hour_short = "%d/%m/%Y %H:%M";
808 $this->format_date_hour_sec_short = "%d/%m/%Y %H:%M:%S";
809 $this->format_date_hour_text_short = "%d %b %Y %H:%M";
810 $this->format_date_hour_text = "%d %B %Y %H:%M";
811
812 // Duration of workday
813 if (!isset($this->global->MAIN_DURATION_OF_WORKDAY)) {
814 $this->global->MAIN_DURATION_OF_WORKDAY = 86400;
815 }
816
817 // Limites decimales si non definie (peuvent etre egale a 0)
818 if (!isset($this->global->MAIN_MAX_DECIMALS_UNIT)) {
819 $this->global->MAIN_MAX_DECIMALS_UNIT = 5;
820 }
821 if (!isset($this->global->MAIN_MAX_DECIMALS_TOT)) {
822 $this->global->MAIN_MAX_DECIMALS_TOT = 2;
823 }
824 if (!isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) {
825 $this->global->MAIN_MAX_DECIMALS_SHOWN = 8;
826 }
827
828 // Default pdf option
829 if (!isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) {
830 $this->global->MAIN_PDF_DASH_BETWEEN_LINES = 1; // use dash between lines
831 }
832 if (!isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
833 $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1; // allow html content into free footer text
834 }
835
836 // Default max file size for upload (deprecated)
837 //$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024);
838
839 // By default, we propagate contacts
840 if (!isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) {
841 $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN = '*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
842 }
843
844 // By default, we do not use the zip town table but the table of third parties
845 if (!isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) {
846 $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY = 0;
847 }
848
849 // By default, we open card if one found
850 if (!isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) {
851 $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1;
852 }
853
854 // By default, we show state code in combo list
855 if (!isset($this->global->MAIN_SHOW_STATE_CODE)) {
856 $this->global->MAIN_SHOW_STATE_CODE = 1;
857 }
858
859 // By default, we show state code in combo list
860 if (!isset($this->global->MULTICURRENCY_USE_ORIGIN_TX)) {
861 $this->global->MULTICURRENCY_USE_ORIGIN_TX = 1;
862 }
863
864 // By default, use an enclosure " for field with CRL or LF into content, + we also remove also CRL/LF chars.
865 if (!isset($this->global->USE_STRICT_CSV_RULES)) {
866 $this->global->USE_STRICT_CSV_RULES = 2;
867 }
868
869 // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
870 if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
871 $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
872 }
873
874 // Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
875 if (!isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) {
876 $this->global->MAIN_MODULES_FOR_EXTERNAL = 'user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,reception,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
877 }
878 if (!empty($this->modules_parts['moduleforexternal'])) { // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
879 foreach ($this->modules_parts['moduleforexternal'] as $key => $value) {
880 $this->global->MAIN_MODULES_FOR_EXTERNAL .= ",".$key;
881 }
882 }
883
884 // Enable select2
885 if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') {
886 $this->global->MAIN_USE_JQUERY_MULTISELECT = 'select2';
887 }
888
889 // Timeouts
890 if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) {
891 $this->global->MAIN_USE_CONNECT_TIMEOUT = 10;
892 }
893 if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) {
894 $this->global->MAIN_USE_RESPONSE_TIMEOUT = 30;
895 }
896
897 // Set default variable to calculate VAT as if option tax_mode was 0 (standard)
898 if (empty($this->global->TAX_MODE_SELL_PRODUCT)) {
899 $this->global->TAX_MODE_SELL_PRODUCT = 'invoice';
900 }
901 if (empty($this->global->TAX_MODE_BUY_PRODUCT)) {
902 $this->global->TAX_MODE_BUY_PRODUCT = 'invoice';
903 }
904 if (empty($this->global->TAX_MODE_SELL_SERVICE)) {
905 $this->global->TAX_MODE_SELL_SERVICE = 'payment';
906 }
907 if (empty($this->global->TAX_MODE_BUY_SERVICE)) {
908 $this->global->TAX_MODE_BUY_SERVICE = 'payment';
909 }
910
911 // Delay before warnings
912 // Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
913 if (isset($this->agenda)) {
914 $this->adherent->subscription = new stdClass();
915 $this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? (int) $this->global->MAIN_DELAY_MEMBERS : 0) * 86400;
916 }
917 if (isset($this->agenda)) {
918 $this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? (int) $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 86400;
919 }
920 if (isset($this->projet)) {
921 $this->projet->warning_delay = (getDolGlobalInt('MAIN_DELAY_PROJECT_TO_CLOSE', 7) * 86400);
922 $this->projet->task = new StdClass();
923 $this->projet->task->warning_delay = (getDolGlobalInt('MAIN_DELAY_TASKS_TODO', 7) * 86400);
924 }
925
926 if (isset($this->commande)) {
927 $this->commande->client = new stdClass();
928 $this->commande->fournisseur = new stdClass();
929 $this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? (int) $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 86400;
930 $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;
931 }
932 if (isset($this->propal)) {
933 $this->propal->cloture = new stdClass();
934 $this->propal->facturation = new stdClass();
935 $this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 86400;
936 $this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 86400;
937 }
938 if (isset($this->facture)) {
939 $this->facture->client = new stdClass();
940 $this->facture->fournisseur = new stdClass();
941 $this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? (int) $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 86400;
942 $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;
943 }
944 if (isset($this->contrat)) {
945 $this->contrat->services = new stdClass();
946 $this->contrat->services->inactifs = new stdClass();
947 $this->contrat->services->expires = new stdClass();
948 $this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? (int) $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 86400;
949 $this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? (int) $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400;
950 }
951 if (isset($this->commande)) {
952 $this->bank->rappro = new stdClass();
953 $this->bank->cheque = new stdClass();
954 $this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? (int) $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400;
955 $this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? (int) $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400;
956 }
957 if (isset($this->expensereport)) {
958 $this->expensereport->approve = new stdClass();
959 $this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 86400;
960 $this->expensereport->payment = new stdClass();
961 $this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 86400;
962 }
963 if (isset($this->holiday)) {
964 $this->holiday->approve = new stdClass();
965 $this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? (int) $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400;
966 }
967
968 if (!empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) {
969 $this->global->PRODUIT_MULTIPRICES_LIMIT = 5;
970 }
971
972 // For modules that want to disable top or left menu
973 if (!empty($this->global->MAIN_HIDE_TOP_MENU)) {
974 $this->dol_hide_topmenu = $this->global->MAIN_HIDE_TOP_MENU;
975 }
976 if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) {
977 $this->dol_hide_leftmenu = $this->global->MAIN_HIDE_LEFT_MENU;
978 }
979
980 if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) {
981 $this->global->MAIN_SIZE_SHORTLIST_LIMIT = 3;
982 }
983
984 // Save inconsistent option
985 if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (!isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO')) {
986 $this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
987 }
988
989 if (!isset($this->global->MAIN_JS_GRAPH)) {
990 $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
991 }
992
993 if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) {
994 $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
995 }
996 if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) {
997 $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
998 }
999
1000 // Enable by default the CSRF protection by token.
1001 if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
1002 // Value 1 makes CSRF check for all POST parameters only
1003 // Value 2 makes also CSRF check for GET requests with action = a sensitive requests like action=del, action=remove...
1004 // Value 3 makes also CSRF check for all GET requests with a param action or massaction (except some sensitive values)
1005 $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 2; // TODO Switch value to 3
1006 // 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)
1007 }
1008
1009 if (!isset($this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA)) {
1010 $this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA = 1;
1011 }
1012
1013 if (!isset($this->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
1014 $this->global->MAIL_SMTP_USE_FROM_FOR_HELO = 2; // Use the domain in $dolibarr_main_url_root (mydomain.com)
1015 }
1016
1017 if (!defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
1018 if (defined('MAIN_ANTIVIRUS_COMMAND')) {
1019 $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND');
1020 }
1021 if (defined('MAIN_ANTIVIRUS_PARAM')) {
1022 $this->global->MAIN_ANTIVIRUS_PARAM = constant('MAIN_ANTIVIRUS_PARAM');
1023 }
1024 }
1025
1026 // For backward compatibility
1027 if (!empty($this->global->LDAP_SYNCHRO_ACTIVE)) {
1028 if ($this->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
1029 $this->global->LDAP_SYNCHRO_ACTIVE = 1;
1030 } elseif ($this->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
1031 $this->global->LDAP_SYNCHRO_ACTIVE = 2;
1032 }
1033 }
1034 // For backward compatibility
1035 if (!empty($this->global->LDAP_MEMBER_ACTIVE) && $this->global->LDAP_MEMBER_ACTIVE == 'ldap2dolibarr') {
1036 $this->global->LDAP_MEMBER_ACTIVE = 2;
1037 }
1038 // For backward compatibility
1039 if (!empty($this->global->LDAP_MEMBER_TYPE_ACTIVE) && $this->global->LDAP_MEMBER_TYPE_ACTIVE == 'ldap2dolibarr') {
1040 $this->global->LDAP_MEMBER_TYPE_ACTIVE = 2;
1041 }
1042
1043 if (!empty($this->global->MAIN_TZUSERINPUTKEY)) {
1044 $this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel'
1045 }
1046
1047 if (!empty($this->global->PRODUIT_AUTOFILL_DESC)) {
1048 $this->global->MAIN_NO_CONCAT_DESCRIPTION = 1;
1049 } else {
1050 unset($this->global->MAIN_NO_CONCAT_DESCRIPTION);
1051 }
1052
1053 // product is new use
1054 if (isset($this->product)) {
1055 // For backward compatibility
1056 $this->produit = $this->product;
1057 }
1058 // invoice is new use, facture is old use still initialised
1059 if (isset($this->facture)) {
1060 $this->invoice = $this->facture;
1061 }
1062 // order is new use, commande is old use still initialised
1063 if (isset($this->commande)) {
1064 $this->order = $this->commande;
1065 }
1066 // contract is new use, contrat is old use still initialised
1067 if (isset($this->contrat)) {
1068 $this->contract = $this->contrat;
1069 }
1070 // category is new use, categorie is old use still initialised
1071 if (isset($this->categorie)) {
1072 $this->category = $this->categorie;
1073 }
1074 // project is new use, projet is old use still initialised
1075 if (isset($this->projet) && !isset($this->project)) {
1076 $this->project = $this->projet;
1077 }
1078 // member is new use, adherent is old use still initialised
1079 if (isset($this->adherent) && !isset($this->member)) {
1080 $this->member = $this->adherent;
1081 }
1082
1083 // Object $mc
1084 if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) {
1085 if (is_object($mc)) {
1086 $mc->setValues($this);
1087 }
1088 }
1089
1090 if (isModEnabled('syslog')) {
1091 // We init log handlers
1092 if (!empty($this->global->SYSLOG_HANDLERS)) {
1093 $handlers = json_decode($this->global->SYSLOG_HANDLERS);
1094 } else {
1095 $handlers = array();
1096 }
1097 foreach ($handlers as $handler) {
1098 $handler_file_found = '';
1099 $dirsyslogs = array('/core/modules/syslog/');
1100 if (!empty($this->modules_parts['syslog']) && is_array($this->modules_parts['syslog'])) {
1101 $dirsyslogs = array_merge($dirsyslogs, $this->modules_parts['syslog']);
1102 }
1103 foreach ($dirsyslogs as $reldir) {
1104 $dir = dol_buildpath($reldir, 0);
1105 $newdir = dol_osencode($dir);
1106 if (is_dir($newdir)) {
1107 $file = $newdir.$handler.'.php';
1108 if (file_exists($file)) {
1109 $handler_file_found = $file;
1110 break;
1111 }
1112 }
1113 }
1114
1115 if (empty($handler_file_found)) {
1116 // If log handler has been removed of is badly setup, we must be able to continue code.
1117 //throw new Exception('Missing log handler file '.$handler.'.php');
1118 continue;
1119 }
1120
1121 require_once $handler_file_found;
1122 $loghandlerinstance = new $handler();
1123 if (!$loghandlerinstance instanceof LogHandlerInterface) {
1124 throw new Exception('Log handler does not extend LogHandlerInterface');
1125 }
1126
1127 if (empty($this->loghandlers[$handler])) {
1128 $this->loghandlers[$handler] = $loghandlerinstance;
1129 }
1130 }
1131 }
1132 }
1133
1134 // Overwrite database values from conf into the conf.php file.
1135 if (!empty($this->file->mailing_limit_sendbyweb)) {
1136 $this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
1137 }
1138 if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { // Limit by web can't be 0
1139 $this->global->MAILING_LIMIT_SENDBYWEB = 25;
1140 }
1141 if (!empty($this->file->mailing_limit_sendbycli)) {
1142 $this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
1143 }
1144 if (!empty($this->file->mailing_limit_sendbyday)) {
1145 $this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday;
1146 }
1147
1148 return 0;
1149 }
1150}
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 enabked.
$standard_menu
Used to store current menu handler.
$expedition_bon
To store module status of special module names.
$mycompany
To store some setup of generic modules.
$theme
Used to store current css (from theme)
$entity
Used to store running instance for multi-company (default 1)
$browser
To store browser info (->name, ->os, ->version, ->ua, ->layout, ...)
__construct()
Constructor.
$entities
Used to store list of entities to use for each element.
setEntityValues($db, $entity)
Load setup values into conf object (read llx_const) for a specified entity Note that this->db->xxx,...
$currency
Used to store current currency (ISO code like 'USD', 'EUR', ...). To get the currency symbol: $langs-...
$disable_compute
To store if javascript/ajax is enabked.
$multicompany
To store properties of multi-company.
$global
To store properties found into database.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
LogHandlerInterface.
$conf db user
Definition repair.php:125
dolDecrypt($chain, $key='')
Decode a string with a symetric encryption.