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