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