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