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