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