1
|
|
|
<?php
|
2
|
|
|
/* Copyright (C) 2018 Alxarafe <[email protected]>
|
3
|
|
|
*
|
4
|
|
|
* This program is free software; you can redistribute it and/or modify
|
5
|
|
|
* it under the terms of the GNU General Public License as published by
|
6
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
7
|
|
|
* (at your option) any later version.
|
8
|
|
|
*
|
9
|
|
|
* This program is distributed in the hope that it will be useful,
|
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
|
|
* GNU General Public License for more details.
|
13
|
|
|
*
|
14
|
|
|
* You should have received a copy of the GNU General Public License
|
15
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
|
|
*/
|
17
|
|
|
namespace Alixar\Base;
|
18
|
|
|
|
19
|
|
|
class Conf
|
20
|
|
|
{
|
21
|
|
|
|
22
|
|
|
/** \public */
|
23
|
|
|
//! To store properties found in conf file
|
24
|
|
|
var $file;
|
25
|
|
|
|
26
|
|
|
/**
|
27
|
|
|
* @var DoliDB Database handler.
|
|
|
|
|
28
|
|
|
*/
|
29
|
|
|
public $db;
|
30
|
|
|
//! To store properties found into database
|
31
|
|
|
public $global;
|
32
|
|
|
//! To store browser info
|
33
|
|
|
var $browser;
|
34
|
|
|
//! To store if javascript/ajax is enabked
|
35
|
|
|
public $use_javascript_ajax;
|
36
|
|
|
//! Used to store current currency (ISO code like 'USD', 'EUR', ...)
|
37
|
|
|
public $currency;
|
38
|
|
|
//! Used to store current css (from theme)
|
39
|
|
|
public $theme; // Contains current theme ("eldy", "auguria", ...)
|
40
|
|
|
public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
|
41
|
|
|
//! Used to store current menu handler
|
42
|
|
|
public $standard_menu;
|
43
|
|
|
public $modules = array(); // List of activated modules
|
44
|
|
|
public $modules_parts = array('css' => array(), 'js' => array(), 'tabs' => array(), 'triggers' => array(), 'login' => array(), 'substitutions' => array(), 'menus' => array(), 'theme' => array(), 'sms' => array(), 'tpl' => array(), 'barcode' => array(), 'models' => array(), 'societe' => array(), 'hooks' => array(), 'dir' => array(), 'syslog' => array());
|
45
|
|
|
var $logbuffer = array();
|
46
|
|
|
|
47
|
|
|
/**
|
48
|
|
|
* @var LogHandlerInterface[]
|
49
|
|
|
*/
|
50
|
|
|
var $loghandlers = array();
|
51
|
|
|
//! To store properties of multi-company
|
52
|
|
|
public $multicompany;
|
53
|
|
|
//! Used to store running instance for multi-company (default 1)
|
54
|
|
|
public $entity = 1;
|
55
|
|
|
//! Used to store list of entities to use for each element
|
56
|
|
|
public $entities = array();
|
57
|
|
|
public $dol_hide_topmenu; // Set if we force param dol_hide_topmenu into login url
|
58
|
|
|
public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url
|
59
|
|
|
public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone
|
60
|
|
|
public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
|
61
|
|
|
public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url
|
62
|
|
|
public $user;
|
63
|
|
|
|
64
|
|
|
/**
|
65
|
|
|
* Constructor
|
66
|
|
|
*/
|
67
|
|
|
function __construct()
|
68
|
|
|
{
|
69
|
|
|
// Properly declare multi-modules objects.
|
70
|
|
|
$this->file = new \stdClass();
|
71
|
|
|
$this->db = new \stdClass();
|
|
|
|
|
72
|
|
|
$this->global = new \stdClass();
|
73
|
|
|
$this->mycompany = new \stdClass();
|
74
|
|
|
$this->admin = new \stdClass();
|
75
|
|
|
$this->user = new \stdClass();
|
76
|
|
|
$this->syslog = new \stdClass();
|
77
|
|
|
$this->browser = new \stdClass();
|
78
|
|
|
$this->medias = new \stdClass();
|
79
|
|
|
$this->multicompany = new \stdClass();
|
80
|
|
|
|
81
|
|
|
//! Charset for HTML output and for storing data in memory
|
82
|
|
|
$this->file->character_set_client = 'UTF-8'; // UTF-8, ISO-8859-1
|
83
|
|
|
// First level object
|
84
|
|
|
// TODO Remove this part.
|
85
|
|
|
$this->expedition_bon = new \stdClass();
|
86
|
|
|
$this->livraison_bon = new \stdClass();
|
87
|
|
|
$this->fournisseur = new \stdClass();
|
88
|
|
|
$this->product = new \stdClass();
|
89
|
|
|
$this->service = new \stdClass();
|
90
|
|
|
$this->contrat = new \stdClass();
|
91
|
|
|
$this->actions = new \stdClass();
|
92
|
|
|
$this->commande = new \stdClass();
|
93
|
|
|
$this->propal = new \stdClass();
|
94
|
|
|
$this->facture = new \stdClass();
|
95
|
|
|
$this->contrat = new \stdClass();
|
96
|
|
|
$this->usergroup = new \stdClass();
|
97
|
|
|
$this->adherent = new \stdClass();
|
98
|
|
|
$this->bank = new \stdClass();
|
99
|
|
|
$this->notification = new \stdClass();
|
100
|
|
|
$this->mailing = new \stdClass();
|
101
|
|
|
$this->expensereport = new \stdClass();
|
102
|
|
|
$this->productbatch = new \stdClass();
|
103
|
|
|
}
|
104
|
|
|
|
105
|
|
|
/**
|
106
|
|
|
* Load setup values into conf object (read llx_const)
|
107
|
|
|
* Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called.
|
108
|
|
|
*
|
109
|
|
|
* @param DoliDB $db Database handler
|
110
|
|
|
* @return int < 0 if KO, >= 0 if OK
|
111
|
|
|
*/
|
112
|
|
|
function setValues($dba)
|
113
|
|
|
{
|
114
|
|
|
// global $conf;
|
115
|
|
|
|
116
|
|
|
var_dump($this);
|
|
|
|
|
117
|
|
|
die('en setValues');
|
|
|
|
|
118
|
|
|
|
119
|
|
|
dol_syslog(get_class($this) . "::setValues");
|
|
|
|
|
120
|
|
|
|
121
|
|
|
//Define all global constants into Conf::$global->key=value
|
122
|
|
|
$sql = "SELECT " . $db->decrypt('name') . " as name,";
|
123
|
|
|
$sql .= " " . $db->decrypt('value') . " as value, entity";
|
124
|
|
|
$sql .= " FROM " . MAIN_DB_PREFIX . "const";
|
125
|
|
|
$sql .= " WHERE entity IN (0," . $this->entity . ")";
|
126
|
|
|
$sql .= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
|
127
|
|
|
|
128
|
|
|
$resql = $db->query($sql);
|
129
|
|
|
if ($resql) {
|
130
|
|
|
$i = 0;
|
131
|
|
|
$numr = $db->num_rows($resql);
|
132
|
|
|
while ($i < $numr) {
|
133
|
|
|
$objp = $db->fetch_object($resql);
|
134
|
|
|
$key = $objp->name;
|
135
|
|
|
$value = $objp->value;
|
136
|
|
|
if ($key) {
|
137
|
|
|
//if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install)
|
138
|
|
|
Conf::$global->$key = $value;
|
139
|
|
|
|
140
|
|
|
if ($value && preg_match('/^MAIN_MODULE_/', $key)) {
|
141
|
|
|
// If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
|
142
|
|
|
if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) {
|
143
|
|
|
$partname = 'tabs';
|
144
|
|
|
$params = explode(':', $value, 2);
|
145
|
|
|
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
|
146
|
|
|
$this->modules_parts[$partname] = array();
|
147
|
|
|
}
|
148
|
|
|
$this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array
|
149
|
|
|
}
|
150
|
|
|
// If this is constant for all generic part activated by a module. It initializes
|
151
|
|
|
// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
|
152
|
|
|
// modules_parts['models'], modules_parts['theme']
|
153
|
|
|
// modules_parts['sms'],
|
154
|
|
|
// modules_parts['css'], ...
|
155
|
|
|
elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
|
156
|
|
|
$modulename = strtolower($reg[1]);
|
157
|
|
|
$partname = strtolower($reg[2]);
|
158
|
|
|
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
|
159
|
|
|
$this->modules_parts[$partname] = array();
|
160
|
|
|
}
|
161
|
|
|
$arrValue = json_decode($value, true);
|
162
|
|
|
if (is_array($arrValue) && !empty($arrValue))
|
163
|
|
|
$value = $arrValue;
|
164
|
|
|
else if (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl')))
|
165
|
|
|
$value = '/' . $modulename . '/core/' . $partname . '/';
|
166
|
|
|
else if (in_array($partname, array('models', 'theme')))
|
167
|
|
|
$value = '/' . $modulename . '/';
|
168
|
|
|
else if (in_array($partname, array('sms')))
|
169
|
|
|
$value = '/' . $modulename . '/';
|
170
|
|
|
else if ($value == 1)
|
171
|
|
|
$value = '/' . $modulename . '/core/modules/' . $partname . '/'; // ex: partname = societe
|
172
|
|
|
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array
|
173
|
|
|
}
|
174
|
|
|
// If this is a module constant (must be at end)
|
175
|
|
|
elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
|
176
|
|
|
$modulename = strtolower($reg[1]);
|
177
|
|
|
if ($modulename == 'propale')
|
178
|
|
|
$modulename = 'propal';
|
179
|
|
|
if ($modulename == 'supplierproposal')
|
180
|
|
|
$modulename = 'supplier_proposal';
|
181
|
|
|
if (!isset($this->$modulename) || !is_object($this->$modulename))
|
182
|
|
|
$this->$modulename = new \stdClass();
|
183
|
|
|
$this->$modulename->enabled = true;
|
184
|
|
|
$this->modules[] = $modulename; // Add this module in list of enabled modules
|
185
|
|
|
}
|
186
|
|
|
}
|
187
|
|
|
}
|
188
|
|
|
$i++;
|
189
|
|
|
}
|
190
|
|
|
|
191
|
|
|
$db->free($resql);
|
192
|
|
|
}
|
193
|
|
|
|
194
|
|
|
// Include other local consts.php files and fetch their values to the corresponding database constants.
|
195
|
|
|
if (!empty(Globals::$conf->$global->LOCAL_CONSTS_FILES)) {
|
196
|
|
|
$filesList = explode(":", Conf::$global->LOCAL_CONSTS_FILES);
|
197
|
|
|
foreach ($filesList as $file) {
|
198
|
|
|
$file = dol_sanitizeFileName($file);
|
199
|
|
|
include_once DOL_DOCUMENT_ROOT . "/" . $file . "/" . $file . "_consts.php";
|
200
|
|
|
foreach ($file2bddconsts as $key => $value) {
|
201
|
|
|
Conf::$global->$key = $value;
|
202
|
|
|
}
|
203
|
|
|
}
|
204
|
|
|
}
|
205
|
|
|
|
206
|
|
|
//var_dump($this->modules);
|
207
|
|
|
//var_dump($this->modules_parts['theme']);
|
208
|
|
|
// If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
|
209
|
|
|
// In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
|
210
|
|
|
//Conf::$global->MAIN_SERVER_TZ='Europe/Paris';
|
211
|
|
|
if (!empty(Globals::$conf->$global->MAIN_SERVER_TZ) && Conf::$global->MAIN_SERVER_TZ != 'auto') {
|
212
|
|
|
try {
|
213
|
|
|
date_default_timezone_set(Globals::$conf->$global->MAIN_SERVER_TZ);
|
214
|
|
|
} catch (Exception $e) {
|
|
|
|
|
215
|
|
|
dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=" . Conf::$global->MAIN_SERVER_TZ, LOG_ERR);
|
216
|
|
|
}
|
217
|
|
|
}
|
218
|
|
|
|
219
|
|
|
// Object $mc
|
220
|
|
|
if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled)) {
|
221
|
|
|
// global $mc;
|
222
|
|
|
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
223
|
|
|
if ($ret) {
|
224
|
|
|
Globals::$mc = new ActionsMulticompany($db);
|
225
|
|
|
}
|
226
|
|
|
}
|
227
|
|
|
|
228
|
|
|
// Clean some variables
|
229
|
|
|
if (empty(Globals::$conf->$global->MAIN_MENU_STANDARD))
|
230
|
|
|
Conf::$global->MAIN_MENU_STANDARD = "eldy_menu.php";
|
231
|
|
|
if (empty(Globals::$conf->$global->MAIN_MENUFRONT_STANDARD))
|
232
|
|
|
Conf::$global->MAIN_MENUFRONT_STANDARD = "eldy_menu.php";
|
233
|
|
|
if (empty(Globals::$conf->$global->MAIN_MENU_SMARTPHONE))
|
234
|
|
|
Conf::$global->MAIN_MENU_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
|
235
|
|
|
if (empty(Globals::$conf->$global->MAIN_MENUFRONT_SMARTPHONE))
|
236
|
|
|
Conf::$global->MAIN_MENUFRONT_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
|
237
|
|
|
|
238
|
|
|
|
239
|
|
|
|
240
|
|
|
|
241
|
|
|
|
242
|
|
|
|
243
|
|
|
// Clean var use vat for company
|
244
|
|
|
if (!isset(Globals::$conf->$global->FACTURE_TVAOPTION))
|
245
|
|
|
Conf::$global->FACTURE_TVAOPTION = 1;
|
246
|
|
|
else if (!empty(Globals::$conf->$global->FACTURE_TVAOPTION) && !is_numeric(Globals::$conf->$global->FACTURE_TVAOPTION)) {
|
247
|
|
|
// Old value of option, we clean to use new value (0 or 1)
|
248
|
|
|
if (Globals::$conf->$global->FACTURE_TVAOPTION != "franchise")
|
249
|
|
|
Conf::$global->FACTURE_TVAOPTION = 1;
|
250
|
|
|
else
|
251
|
|
|
Conf::$global->FACTURE_TVAOPTION = 0;
|
252
|
|
|
}
|
253
|
|
|
|
254
|
|
|
// Variable globales LDAP
|
255
|
|
|
if (empty(Globals::$conf->$global->LDAP_FIELD_FULLNAME))
|
256
|
|
|
Conf::$global->LDAP_FIELD_FULLNAME = '';
|
257
|
|
|
if (!isset(Globals::$conf->$global->LDAP_KEY_USERS))
|
258
|
|
|
Conf::$global->LDAP_KEY_USERS = Conf::$global->LDAP_FIELD_FULLNAME;
|
259
|
|
|
if (!isset(Globals::$conf->$global->LDAP_KEY_GROUPS))
|
260
|
|
|
Conf::$global->LDAP_KEY_GROUPS = Conf::$global->LDAP_FIELD_FULLNAME;
|
261
|
|
|
if (!isset(Globals::$conf->$global->LDAP_KEY_CONTACTS))
|
262
|
|
|
Conf::$global->LDAP_KEY_CONTACTS = Conf::$global->LDAP_FIELD_FULLNAME;
|
263
|
|
|
if (!isset(Globals::$conf->$global->LDAP_KEY_MEMBERS))
|
264
|
|
|
Conf::$global->LDAP_KEY_MEMBERS = Conf::$global->LDAP_FIELD_FULLNAME;
|
265
|
|
|
if (!isset(Globals::$conf->$global->LDAP_KEY_MEMBERS_TYPES))
|
266
|
|
|
Conf::$global->LDAP_KEY_MEMBERS_TYPES = Conf::$global->LDAP_FIELD_FULLNAME;
|
267
|
|
|
|
268
|
|
|
// Load translation object with current language
|
269
|
|
|
if (empty(Globals::$conf->$global->MAIN_LANG_DEFAULT))
|
270
|
|
|
Conf::$global->MAIN_LANG_DEFAULT = "en_US";
|
271
|
|
|
|
272
|
|
|
$rootfordata = DOL_DATA_ROOT;
|
273
|
|
|
$rootforuser = DOL_DATA_ROOT;
|
274
|
|
|
// If multicompany module is enabled, we redefine the root of data
|
275
|
|
|
if (!empty($this->multicompany->enabled) && !empty($this->entity) && $this->entity > 1) {
|
276
|
|
|
$rootfordata .= '/' . $this->entity;
|
277
|
|
|
}
|
278
|
|
|
|
279
|
|
|
// Define default dir_output and dir_temp for directories of modules
|
280
|
|
|
foreach ($this->modules as $module) {
|
281
|
|
|
//var_dump($module);
|
282
|
|
|
// For multicompany sharings
|
283
|
|
|
$this->$module->multidir_output = array($this->entity => $rootfordata . "/" . $module);
|
284
|
|
|
$this->$module->multidir_temp = array($this->entity => $rootfordata . "/" . $module . "/temp");
|
285
|
|
|
// For backward compatibility
|
286
|
|
|
$this->$module->dir_output = $rootfordata . "/" . $module;
|
287
|
|
|
$this->$module->dir_temp = $rootfordata . "/" . $module . "/temp";
|
288
|
|
|
}
|
289
|
|
|
|
290
|
|
|
// External modules storage
|
291
|
|
|
if (!empty($this->modules_parts['dir'])) {
|
292
|
|
|
foreach ($this->modules_parts['dir'] as $module => $dirs) {
|
293
|
|
|
if (!empty($this->$module->enabled)) {
|
294
|
|
|
foreach ($dirs as $type => $name) {
|
295
|
|
|
$subdir = ($type == 'temp' ? '/temp' : '');
|
296
|
|
|
// For multicompany sharings
|
297
|
|
|
$varname = 'multidir_' . $type;
|
298
|
|
|
$this->$module->$varname = array($this->entity => $rootfordata . "/" . $name . $subdir);
|
299
|
|
|
// For backward compatibility
|
300
|
|
|
$varname = 'dir_' . $type;
|
301
|
|
|
$this->$module->$varname = $rootfordata . "/" . $name . $subdir;
|
302
|
|
|
}
|
303
|
|
|
}
|
304
|
|
|
}
|
305
|
|
|
}
|
306
|
|
|
|
307
|
|
|
// For mycompany storage
|
308
|
|
|
$this->mycompany->dir_output = $rootfordata . "/mycompany";
|
309
|
|
|
$this->mycompany->dir_temp = $rootfordata . "/mycompany/temp";
|
310
|
|
|
|
311
|
|
|
// For admin storage
|
312
|
|
|
$this->admin->dir_output = $rootfordata . '/admin';
|
313
|
|
|
$this->admin->dir_temp = $rootfordata . '/admin/temp';
|
314
|
|
|
|
315
|
|
|
// For user storage
|
316
|
|
|
$this->user->multidir_output = array($this->entity => $rootfordata . "/users");
|
317
|
|
|
$this->user->multidir_temp = array($this->entity => $rootfordata . "/users/temp");
|
318
|
|
|
// For backward compatibility
|
319
|
|
|
$this->user->dir_output = $rootforuser . "/users";
|
320
|
|
|
$this->user->dir_temp = $rootforuser . "/users/temp";
|
321
|
|
|
|
322
|
|
|
// For usergroup storage
|
323
|
|
|
$this->usergroup->dir_output = $rootforuser . "/usergroups";
|
324
|
|
|
$this->usergroup->dir_temp = $rootforuser . "/usergroups/temp";
|
325
|
|
|
|
326
|
|
|
// For proposal storage
|
327
|
|
|
$this->propal->multidir_output = array($this->entity => $rootfordata . "/propale");
|
328
|
|
|
$this->propal->multidir_temp = array($this->entity => $rootfordata . "/propale/temp");
|
329
|
|
|
// For backward compatibility
|
330
|
|
|
$this->propal->dir_output = $rootfordata . "/propale";
|
331
|
|
|
$this->propal->dir_temp = $rootfordata . "/propale/temp";
|
332
|
|
|
|
333
|
|
|
// For medias storage
|
334
|
|
|
$this->medias->multidir_output = array($this->entity => $rootfordata . "/medias");
|
335
|
|
|
$this->medias->multidir_temp = array($this->entity => $rootfordata . "/medias/temp");
|
336
|
|
|
|
337
|
|
|
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
338
|
|
|
// Sous module bons d'expedition
|
339
|
|
|
$this->expedition_bon->enabled = (!empty(Globals::$conf->$global->MAIN_SUBMODULE_EXPEDITION) ? Conf::$global->MAIN_SUBMODULE_EXPEDITION : 0);
|
340
|
|
|
// Sous module bons de livraison
|
341
|
|
|
$this->livraison_bon->enabled = (!empty(Globals::$conf->$global->MAIN_SUBMODULE_LIVRAISON) ? Conf::$global->MAIN_SUBMODULE_LIVRAISON : 0);
|
342
|
|
|
|
343
|
|
|
// Module fournisseur
|
344
|
|
|
if (!empty($this->fournisseur)) {
|
345
|
|
|
$this->fournisseur->commande = new \stdClass();
|
346
|
|
|
$this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata . "/fournisseur/commande");
|
347
|
|
|
$this->fournisseur->commande->multidir_temp = array($this->entity => $rootfordata . "/fournisseur/commande/temp");
|
348
|
|
|
$this->fournisseur->commande->dir_output = $rootfordata . "/fournisseur/commande"; // For backward compatibility
|
349
|
|
|
$this->fournisseur->commande->dir_temp = $rootfordata . "/fournisseur/commande/temp"; // For backward compatibility
|
350
|
|
|
$this->fournisseur->facture = new \stdClass();
|
351
|
|
|
$this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata . "/fournisseur/facture");
|
352
|
|
|
$this->fournisseur->facture->multidir_temp = array($this->entity => $rootfordata . "/fournisseur/facture/temp");
|
353
|
|
|
$this->fournisseur->facture->dir_output = $rootfordata . "/fournisseur/facture"; // For backward compatibility
|
354
|
|
|
$this->fournisseur->facture->dir_temp = $rootfordata . "/fournisseur/facture/temp"; // For backward compatibility
|
355
|
|
|
$this->supplierproposal = new \stdClass();
|
356
|
|
|
$this->supplierproposal->multidir_output = array($this->entity => $rootfordata . "/supplier_proposal");
|
357
|
|
|
$this->supplierproposal->multidir_temp = array($this->entity => $rootfordata . "/supplier_proposal/temp");
|
358
|
|
|
$this->supplierproposal->dir_output = $rootfordata . "/supplier_proposal"; // For backward compatibility
|
359
|
|
|
$this->supplierproposal->dir_temp = $rootfordata . "/supplier_proposal/temp"; // For backward compatibility
|
360
|
|
|
$this->fournisseur->payment = new \stdClass();
|
361
|
|
|
$this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata . "/fournisseur/payment");
|
362
|
|
|
$this->fournisseur->payment->multidir_temp = array($this->entity => $rootfordata . "/fournisseur/payment/temp");
|
363
|
|
|
$this->fournisseur->payment->dir_output = $rootfordata . "/fournisseur/payment"; // For backward compatibility
|
364
|
|
|
$this->fournisseur->payment->dir_temp = $rootfordata . "/fournisseur/payment/temp"; // For backward compatibility
|
365
|
|
|
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
|
366
|
|
|
if (!empty($this->fournisseur->enabled) && empty(Globals::$conf->$global->MAIN_USE_NEW_SUPPLIERMOD)) { // By default, if module supplier is on, we set new properties
|
367
|
|
|
$this->supplier_order = new \stdClass();
|
368
|
|
|
$this->supplier_order->enabled = 1;
|
369
|
|
|
$this->supplier_order->multidir_output = array($this->entity => $rootfordata . "/fournisseur/commande");
|
370
|
|
|
$this->supplier_order->multidir_temp = array($this->entity => $rootfordata . "/fournisseur/commande/temp");
|
371
|
|
|
$this->supplier_order->dir_output = $rootfordata . "/fournisseur/commande"; // For backward compatibility
|
372
|
|
|
$this->supplier_order->dir_temp = $rootfordata . "/fournisseur/commande/temp"; // For backward compatibility
|
373
|
|
|
$this->supplier_invoice = new \stdClass();
|
374
|
|
|
$this->supplier_invoice->enabled = 1;
|
375
|
|
|
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata . "/fournisseur/facture");
|
376
|
|
|
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfordata . "/fournisseur/facture/temp");
|
377
|
|
|
$this->supplier_invoice->dir_output = $rootfordata . "/fournisseur/facture"; // For backward compatibility
|
378
|
|
|
$this->supplier_invoice->dir_temp = $rootfordata . "/fournisseur/facture/temp"; // For backward compatibility
|
379
|
|
|
$this->supplierproposal = new \stdClass();
|
380
|
|
|
$this->supplierproposal->multidir_output = array($this->entity => $rootfordata . "/supplier_proposal");
|
381
|
|
|
$this->supplierproposal->multidir_temp = array($this->entity => $rootfordata . "/supplier_proposal/temp");
|
382
|
|
|
$this->supplierproposal->dir_output = $rootfordata . "/supplier_proposal"; // For backward compatibility
|
383
|
|
|
$this->supplierproposal->dir_temp = $rootfordata . "/supplier_proposal/temp"; // For backward compatibility
|
384
|
|
|
}
|
385
|
|
|
}
|
386
|
|
|
|
387
|
|
|
// Module product/service
|
388
|
|
|
$this->product->multidir_output = array($this->entity => $rootfordata . "/produit");
|
389
|
|
|
$this->product->multidir_temp = array($this->entity => $rootfordata . "/produit/temp");
|
390
|
|
|
$this->service->multidir_output = array($this->entity => $rootfordata . "/produit");
|
391
|
|
|
$this->service->multidir_temp = array($this->entity => $rootfordata . "/produit/temp");
|
392
|
|
|
// For backward compatibility
|
393
|
|
|
$this->product->dir_output = $rootfordata . "/produit";
|
394
|
|
|
$this->product->dir_temp = $rootfordata . "/produit/temp";
|
395
|
|
|
$this->service->dir_output = $rootfordata . "/produit";
|
396
|
|
|
$this->service->dir_temp = $rootfordata . "/produit/temp";
|
397
|
|
|
|
398
|
|
|
// Module productbatch
|
399
|
|
|
$this->productbatch->multidir_output = array($this->entity => $rootfordata . "/produitlot");
|
400
|
|
|
$this->productbatch->multidir_temp = array($this->entity => $rootfordata . "/produitlot/temp");
|
401
|
|
|
|
402
|
|
|
// Module contrat
|
403
|
|
|
$this->contrat->multidir_output = array($this->entity => $rootfordata . "/contract");
|
404
|
|
|
$this->contrat->multidir_temp = array($this->entity => $rootfordata . "/contract/temp");
|
405
|
|
|
// For backward compatibility
|
406
|
|
|
$this->contrat->dir_output = $rootfordata . "/contract";
|
407
|
|
|
$this->contrat->dir_temp = $rootfordata . "/contract/temp";
|
408
|
|
|
|
409
|
|
|
// Module bank
|
410
|
|
|
$this->bank->dir_output = $rootfordata . "/bank";
|
411
|
|
|
$this->bank->dir_temp = $rootfordata . "/bank/temp";
|
412
|
|
|
|
413
|
|
|
|
414
|
|
|
// Set some default values
|
415
|
|
|
//Conf::$global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
|
416
|
|
|
Conf::$global->MAIN_ACTIVATE_HTML5 = 1;
|
417
|
|
|
Conf::$global->MAIN_MAIL_USE_MULTI_PART = 1;
|
418
|
|
|
|
419
|
|
|
// societe
|
420
|
|
|
if (empty(Globals::$conf->$global->SOCIETE_CODECLIENT_ADDON))
|
421
|
|
|
Conf::$global->SOCIETE_CODECLIENT_ADDON = "mod_codeclient_leopard";
|
422
|
|
|
if (empty(Globals::$conf->$global->SOCIETE_CODECOMPTA_ADDON))
|
423
|
|
|
Conf::$global->SOCIETE_CODECOMPTA_ADDON = "mod_codecompta_panicum";
|
424
|
|
|
|
425
|
|
|
if (empty(Globals::$conf->$global->CHEQUERECEIPTS_ADDON))
|
426
|
|
|
Conf::$global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipt_mint';
|
427
|
|
|
if (empty(Globals::$conf->global->TICKETSUP_ADDON))
|
428
|
|
|
Conf::$global->TICKETSUP_ADDON = 'mod_ticket_simple';
|
429
|
|
|
|
430
|
|
|
// Security
|
431
|
|
|
if (empty(Globals::$conf->$global->USER_PASSWORD_GENERATED))
|
432
|
|
|
Conf::$global->USER_PASSWORD_GENERATED = 'standard'; // Default password generator
|
433
|
|
|
if (empty(Globals::$conf->$global->MAIN_UMASK))
|
434
|
|
|
Conf::$global->MAIN_UMASK = '0664'; // Default mask
|
435
|
|
|
|
436
|
|
|
|
437
|
|
|
|
438
|
|
|
|
439
|
|
|
|
440
|
|
|
|
441
|
|
|
|
442
|
|
|
// conf->use_javascript_ajax
|
443
|
|
|
$this->use_javascript_ajax = 1;
|
444
|
|
|
if (isset(Globals::$conf->$global->MAIN_DISABLE_JAVASCRIPT))
|
445
|
|
|
$this->use_javascript_ajax = !Conf::$global->MAIN_DISABLE_JAVASCRIPT;
|
446
|
|
|
// If no javascript_ajax, Ajax features are disabled.
|
447
|
|
|
if (empty($this->use_javascript_ajax)) {
|
448
|
|
|
unset(Globals::$conf->$global->PRODUIT_USE_SEARCH_TO_SELECT);
|
449
|
|
|
unset(Globals::$conf->$global->COMPANY_USE_SEARCH_TO_SELECT);
|
450
|
|
|
unset(Globals::$conf->$global->CONTACT_USE_SEARCH_TO_SELECT);
|
451
|
|
|
unset(Globals::$conf->$global->PROJECT_USE_SEARCH_TO_SELECT);
|
452
|
|
|
}
|
453
|
|
|
|
454
|
|
|
if (!empty($this->productbatch->enabled)) {
|
455
|
|
|
Conf::$global->STOCK_CALCULATE_ON_BILL = 0;
|
456
|
|
|
Conf::$global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
|
457
|
|
|
Conf::$global->STOCK_CALCULATE_ON_SHIPMENT = 1;
|
458
|
|
|
Conf::$global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0;
|
459
|
|
|
Conf::$global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
|
460
|
|
|
Conf::$global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
|
461
|
|
|
if (empty($this->reception->enabled))
|
462
|
|
|
Conf::$global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
|
463
|
|
|
else {
|
464
|
|
|
Conf::$global->STOCK_CALCULATE_ON_RECEPTION = 1;
|
465
|
|
|
Conf::$global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0;
|
466
|
|
|
}
|
467
|
|
|
}
|
468
|
|
|
|
469
|
|
|
// conf->currency
|
470
|
|
|
if (empty(Globals::$conf->$global->MAIN_MONNAIE))
|
471
|
|
|
Conf::$global->MAIN_MONNAIE = 'EUR';
|
472
|
|
|
$this->currency = Conf::$global->MAIN_MONNAIE;
|
473
|
|
|
|
474
|
|
|
if (empty(Globals::$conf->$global->MAIN_BROWSER_NOTIFICATION_FREQUENCY))
|
475
|
|
|
Conf::$global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
|
476
|
|
|
|
477
|
|
|
|
478
|
|
|
|
479
|
|
|
|
480
|
|
|
|
481
|
|
|
|
482
|
|
|
|
483
|
|
|
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
|
484
|
|
|
if (empty(Globals::$conf->$global->ACCOUNTING_MODE))
|
485
|
|
|
Conf::$global->ACCOUNTING_MODE = 'RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
|
486
|
|
|
|
487
|
|
|
|
488
|
|
|
|
489
|
|
|
|
490
|
|
|
|
491
|
|
|
|
492
|
|
|
|
493
|
|
|
// By default, suppliers objects can be linked to all projects
|
494
|
|
|
Conf::$global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
|
495
|
|
|
|
496
|
|
|
// MAIN_HTML_TITLE
|
497
|
|
|
if (!isset(Globals::$conf->$global->MAIN_HTML_TITLE))
|
498
|
|
|
Conf::$global->MAIN_HTML_TITLE = 'noapp,thirdpartynameonly,contactnameonly,projectnameonly';
|
499
|
|
|
|
500
|
|
|
// conf->liste_limit = constante de taille maximale des listes
|
501
|
|
|
if (empty(Globals::$conf->$global->MAIN_SIZE_LISTE_LIMIT))
|
502
|
|
|
Conf::$global->MAIN_SIZE_LISTE_LIMIT = 25;
|
503
|
|
|
$this->liste_limit = Conf::$global->MAIN_SIZE_LISTE_LIMIT;
|
504
|
|
|
|
505
|
|
|
// conf->product->limit_size = constante de taille maximale des select de produit
|
506
|
|
|
if (!isset(Globals::$conf->$global->PRODUIT_LIMIT_SIZE))
|
507
|
|
|
Conf::$global->PRODUIT_LIMIT_SIZE = 1000;
|
508
|
|
|
$this->product->limit_size = Conf::$global->PRODUIT_LIMIT_SIZE;
|
509
|
|
|
|
510
|
|
|
// conf->theme et $this->css
|
511
|
|
|
if (empty(Globals::$conf->$global->MAIN_THEME))
|
512
|
|
|
Conf::$global->MAIN_THEME = "eldy";
|
513
|
|
|
if (!empty(Globals::$conf->$global->MAIN_FORCETHEME))
|
514
|
|
|
Conf::$global->MAIN_THEME = Conf::$global->MAIN_FORCETHEME;
|
515
|
|
|
$this->theme = Conf::$global->MAIN_THEME;
|
516
|
|
|
//$this->css = "/theme/".$this->theme."/style.css.php";
|
517
|
|
|
$this->css = '?controller=theme/' . $this->theme . '&method=style.css';
|
518
|
|
|
|
519
|
|
|
// conf->email_from = email pour envoi par dolibarr des mails automatiques
|
520
|
|
|
$this->email_from = "[email protected]";
|
521
|
|
|
if (!empty(Globals::$conf->$global->MAIN_MAIL_EMAIL_FROM))
|
522
|
|
|
$this->email_from = Conf::$global->MAIN_MAIL_EMAIL_FROM;
|
523
|
|
|
|
524
|
|
|
// conf->notification->email_from = email pour envoi par Dolibarr des notifications
|
525
|
|
|
$this->notification->email_from = $this->email_from;
|
526
|
|
|
if (!empty(Globals::$conf->$global->NOTIFICATION_EMAIL_FROM))
|
527
|
|
|
$this->notification->email_from = Conf::$global->NOTIFICATION_EMAIL_FROM;
|
528
|
|
|
|
529
|
|
|
// conf->mailing->email_from = email pour envoi par Dolibarr des mailings
|
530
|
|
|
$this->mailing->email_from = $this->email_from;
|
531
|
|
|
if (!empty(Globals::$conf->$global->MAILING_EMAIL_FROM))
|
532
|
|
|
$this->mailing->email_from = Conf::$global->MAILING_EMAIL_FROM;
|
533
|
|
|
if (!isset(Globals::$conf->$global->MAIN_EMAIL_ADD_TRACK_ID))
|
534
|
|
|
Conf::$global->MAIN_EMAIL_ADD_TRACK_ID = 1;
|
535
|
|
|
|
536
|
|
|
// Format for date (used by default when not found or not searched in lang)
|
537
|
|
|
$this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
|
538
|
|
|
$this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags
|
539
|
|
|
$this->format_hour_short = "%H:%M";
|
540
|
|
|
$this->format_hour_short_duration = "%H:%M";
|
541
|
|
|
$this->format_date_text_short = "%d %b %Y";
|
542
|
|
|
$this->format_date_text = "%d %B %Y";
|
543
|
|
|
$this->format_date_hour_short = "%d/%m/%Y %H:%M";
|
544
|
|
|
$this->format_date_hour_sec_short = "%d/%m/%Y %H:%M:%S";
|
545
|
|
|
$this->format_date_hour_text_short = "%d %b %Y %H:%M";
|
546
|
|
|
$this->format_date_hour_text = "%d %B %Y %H:%M";
|
547
|
|
|
|
548
|
|
|
// Duration of workday
|
549
|
|
|
if (!isset(Globals::$conf->$global->MAIN_DURATION_OF_WORKDAY))
|
550
|
|
|
Conf::$global->MAIN_DURATION_OF_WORKDAY = 86400;
|
551
|
|
|
|
552
|
|
|
// Limites decimales si non definie (peuvent etre egale a 0)
|
553
|
|
|
if (!isset(Globals::$conf->$global->MAIN_MAX_DECIMALS_UNIT))
|
554
|
|
|
Conf::$global->MAIN_MAX_DECIMALS_UNIT = 5;
|
555
|
|
|
if (!isset(Globals::$conf->$global->MAIN_MAX_DECIMALS_TOT))
|
556
|
|
|
Conf::$global->MAIN_MAX_DECIMALS_TOT = 2;
|
557
|
|
|
if (!isset(Globals::$conf->$global->MAIN_MAX_DECIMALS_SHOWN))
|
558
|
|
|
Conf::$global->MAIN_MAX_DECIMALS_SHOWN = 8;
|
559
|
|
|
|
560
|
|
|
// Default pdf option
|
561
|
|
|
if (!isset(Globals::$conf->$global->MAIN_PDF_DASH_BETWEEN_LINES))
|
562
|
|
|
Conf::$global->MAIN_PDF_DASH_BETWEEN_LINES = 1; // use dash between lines
|
563
|
|
|
if (!isset(Globals::$conf->$global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
564
|
|
|
Conf::$global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1; // allow html content into free footer text
|
565
|
|
|
|
566
|
|
|
|
567
|
|
|
|
568
|
|
|
|
569
|
|
|
|
570
|
|
|
|
571
|
|
|
|
572
|
|
|
// Set default value to MAIN_SHOW_LOGO
|
573
|
|
|
if (!isset(Globals::$conf->$global->MAIN_SHOW_LOGO))
|
574
|
|
|
Conf::$global->MAIN_SHOW_LOGO = 1;
|
575
|
|
|
|
576
|
|
|
// Default max file size for upload
|
577
|
|
|
$this->maxfilesize = (empty(Globals::$conf->$global->MAIN_UPLOAD_DOC) ? 0 : (int) Conf::$global->MAIN_UPLOAD_DOC * 1024);
|
578
|
|
|
|
579
|
|
|
// By default, we propagate contacts
|
580
|
|
|
if (!isset(Globals::$conf->$global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
581
|
|
|
Conf::$global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN = '*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
|
582
|
|
|
|
583
|
|
|
|
584
|
|
|
|
585
|
|
|
|
586
|
|
|
|
587
|
|
|
|
588
|
|
|
|
589
|
|
|
// By default, we do not use the zip town table but the table of third parties
|
590
|
|
|
if (!isset(Globals::$conf->$global->MAIN_USE_ZIPTOWN_DICTIONNARY))
|
591
|
|
|
Conf::$global->MAIN_USE_ZIPTOWN_DICTIONNARY = 0;
|
592
|
|
|
|
593
|
|
|
// By default, we open card if one found
|
594
|
|
|
if (!isset(Globals::$conf->$global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
595
|
|
|
Conf::$global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1;
|
596
|
|
|
|
597
|
|
|
// By default, we show state code in combo list
|
598
|
|
|
if (!isset(Globals::$conf->$global->MAIN_SHOW_STATE_CODE))
|
599
|
|
|
Conf::$global->MAIN_SHOW_STATE_CODE = 1;
|
600
|
|
|
|
601
|
|
|
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
|
602
|
|
|
if (!isset(Globals::$conf->$global->MAIN_MODULES_FOR_EXTERNAL))
|
603
|
|
|
Conf::$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.
|
604
|
|
|
if (!empty($this->modules_parts['moduleforexternal'])) { // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
|
605
|
|
|
foreach ($this->modules_parts['moduleforexternal'] as $key => $value)
|
606
|
|
|
Conf::$global->MAIN_MODULES_FOR_EXTERNAL .= "," . $key;
|
607
|
|
|
}
|
608
|
|
|
|
609
|
|
|
// Enable select2
|
610
|
|
|
if (empty(Globals::$conf->$global->MAIN_USE_JQUERY_MULTISELECT) || Conf::$global->MAIN_USE_JQUERY_MULTISELECT == '1')
|
611
|
|
|
Conf::$global->MAIN_USE_JQUERY_MULTISELECT = 'select2';
|
612
|
|
|
|
613
|
|
|
// Timeouts
|
614
|
|
|
if (empty(Globals::$conf->$global->MAIN_USE_CONNECT_TIMEOUT))
|
615
|
|
|
Conf::$global->MAIN_USE_CONNECT_TIMEOUT = 10;
|
616
|
|
|
if (empty(Globals::$conf->$global->MAIN_USE_RESPONSE_TIMEOUT))
|
617
|
|
|
Conf::$global->MAIN_USE_RESPONSE_TIMEOUT = 30;
|
618
|
|
|
|
619
|
|
|
// Set default variable to calculate VAT as if option tax_mode was 0 (standard)
|
620
|
|
|
if (empty(Globals::$conf->$global->TAX_MODE_SELL_PRODUCT))
|
621
|
|
|
Conf::$global->TAX_MODE_SELL_PRODUCT = 'invoice';
|
622
|
|
|
if (empty(Globals::$conf->$global->TAX_MODE_BUY_PRODUCT))
|
623
|
|
|
Conf::$global->TAX_MODE_BUY_PRODUCT = 'invoice';
|
624
|
|
|
if (empty(Globals::$conf->$global->TAX_MODE_SELL_SERVICE))
|
625
|
|
|
Conf::$global->TAX_MODE_SELL_SERVICE = 'payment';
|
626
|
|
|
if (empty(Globals::$conf->$global->TAX_MODE_BUY_SERVICE))
|
627
|
|
|
Conf::$global->TAX_MODE_BUY_SERVICE = 'payment';
|
628
|
|
|
|
629
|
|
|
// Delay before warnings
|
630
|
|
|
// Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
|
631
|
|
|
if (isset($this->agenda)) {
|
632
|
|
|
$this->adherent->subscription = new \stdClass();
|
633
|
|
|
$this->adherent->subscription->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_MEMBERS) ? Conf::$global->MAIN_DELAY_MEMBERS : 0) * 24 * 60 * 60;
|
634
|
|
|
}
|
635
|
|
|
if (isset($this->agenda))
|
636
|
|
|
$this->agenda->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_ACTIONS_TODO) ? Conf::$global->MAIN_DELAY_ACTIONS_TODO : 7) * 24 * 60 * 60;
|
637
|
|
|
if (isset($this->projet)) {
|
638
|
|
|
$this->projet->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_PROJECT_TO_CLOSE) ? Conf::$global->MAIN_DELAY_PROJECT_TO_CLOSE : 7) * 24 * 60 * 60;
|
639
|
|
|
$this->projet->task = new StdClass();
|
|
|
|
|
640
|
|
|
$this->projet->task->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_TASKS_TODO) ? Conf::$global->MAIN_DELAY_TASKS_TODO : 7) * 24 * 60 * 60;
|
641
|
|
|
}
|
642
|
|
|
|
643
|
|
|
if (isset($this->commande)) {
|
644
|
|
|
$this->commande->client = new \stdClass();
|
645
|
|
|
$this->commande->fournisseur = new \stdClass();
|
646
|
|
|
$this->commande->client->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_ORDERS_TO_PROCESS) ? Conf::$global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 24 * 60 * 60;
|
647
|
|
|
$this->commande->fournisseur->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? Conf::$global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 24 * 60 * 60;
|
648
|
|
|
}
|
649
|
|
|
if (isset($this->propal)) {
|
650
|
|
|
$this->propal->cloture = new \stdClass();
|
651
|
|
|
$this->propal->facturation = new \stdClass();
|
652
|
|
|
$this->propal->cloture->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_PROPALS_TO_CLOSE) ? Conf::$global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 24 * 60 * 60;
|
653
|
|
|
$this->propal->facturation->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_PROPALS_TO_BILL) ? Conf::$global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 24 * 60 * 60;
|
654
|
|
|
}
|
655
|
|
|
if (isset($this->facture)) {
|
656
|
|
|
$this->facture->client = new \stdClass();
|
657
|
|
|
$this->facture->fournisseur = new \stdClass();
|
658
|
|
|
$this->facture->client->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? Conf::$global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 24 * 60 * 60;
|
659
|
|
|
$this->facture->fournisseur->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? Conf::$global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 24 * 60 * 60;
|
660
|
|
|
}
|
661
|
|
|
if (isset($this->contrat)) {
|
662
|
|
|
$this->contrat->services = new \stdClass();
|
663
|
|
|
$this->contrat->services->inactifs = new \stdClass();
|
664
|
|
|
$this->contrat->services->expires = new \stdClass();
|
665
|
|
|
$this->contrat->services->inactifs->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? Conf::$global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 24 * 60 * 60;
|
666
|
|
|
$this->contrat->services->expires->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_RUNNING_SERVICES) ? Conf::$global->MAIN_DELAY_RUNNING_SERVICES : 0) * 24 * 60 * 60;
|
667
|
|
|
}
|
668
|
|
|
if (isset($this->commande)) {
|
669
|
|
|
$this->bank->rappro = new \stdClass();
|
670
|
|
|
$this->bank->cheque = new \stdClass();
|
671
|
|
|
$this->bank->rappro->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? Conf::$global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 24 * 60 * 60;
|
672
|
|
|
$this->bank->cheque->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? Conf::$global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 24 * 60 * 60;
|
673
|
|
|
}
|
674
|
|
|
if (isset($this->expensereport)) {
|
675
|
|
|
$this->expensereport->approve = new \stdClass();
|
676
|
|
|
$this->expensereport->approve->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_EXPENSEREPORTS) ? Conf::$global->MAIN_DELAY_EXPENSEREPORTS : 0) * 24 * 60 * 60;
|
677
|
|
|
$this->expensereport->payment = new \stdClass();
|
678
|
|
|
$this->expensereport->payment->warning_delay = (isset(Globals::$conf->$global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? Conf::$global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 24 * 60 * 60;
|
679
|
|
|
}
|
680
|
|
|
|
681
|
|
|
if (!empty(Globals::$conf->$global->PRODUIT_MULTIPRICES) && empty(Globals::$conf->$global->PRODUIT_MULTIPRICES_LIMIT)) {
|
682
|
|
|
Conf::$global->PRODUIT_MULTIPRICES_LIMIT = 5;
|
683
|
|
|
}
|
684
|
|
|
|
685
|
|
|
// For modules that want to disable top or left menu
|
686
|
|
|
if (!empty(Globals::$conf->$global->MAIN_HIDE_TOP_MENU))
|
687
|
|
|
$this->dol_hide_topmenu = Conf::$global->MAIN_HIDE_TOP_MENU;
|
688
|
|
|
if (!empty(Globals::$conf->$global->MAIN_HIDE_LEFT_MENU))
|
689
|
|
|
$this->dol_hide_leftmenu = Conf::$global->MAIN_HIDE_LEFT_MENU;
|
690
|
|
|
|
691
|
|
|
if (empty(Globals::$conf->$global->MAIN_SIZE_SHORTLIST_LIMIT))
|
692
|
|
|
Conf::$global->MAIN_SIZE_SHORTLIST_LIMIT = 3;
|
693
|
|
|
|
694
|
|
|
if (!isset(Globals::$conf->$global->THEME_HIDE_BORDER_ON_INPUT))
|
695
|
|
|
Conf::$global->THEME_HIDE_BORDER_ON_INPUT = 0;
|
696
|
|
|
|
697
|
|
|
// Save inconsistent option
|
698
|
|
|
if (empty(Globals::$conf->$global->AGENDA_USE_EVENT_TYPE) && (!isset(Globals::$conf->$global->AGENDA_DEFAULT_FILTER_TYPE) || Conf::$global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO')) {
|
699
|
|
|
Conf::$global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
|
700
|
|
|
}
|
701
|
|
|
|
702
|
|
|
if (!isset(Globals::$conf->$global->MAIN_EXTRAFIELDS_IN_ONE_TD))
|
703
|
|
|
Conf::$global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
|
704
|
|
|
|
705
|
|
|
Conf::$global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
|
706
|
|
|
Conf::$global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
|
707
|
|
|
|
708
|
|
|
// For backward compatibility
|
709
|
|
|
if (isset($this->product))
|
710
|
|
|
$this->produit = $this->product;
|
711
|
|
|
if (isset($this->facture))
|
712
|
|
|
$this->invoice = $this->facture;
|
713
|
|
|
if (isset($this->commande))
|
714
|
|
|
$this->order = $this->commande;
|
715
|
|
|
if (isset($this->contrat))
|
716
|
|
|
$this->contract = $this->contrat;
|
717
|
|
|
if (isset($this->categorie))
|
718
|
|
|
$this->category = $this->categorie;
|
719
|
|
|
|
720
|
|
|
// Object $mc
|
721
|
|
|
if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled)) {
|
722
|
|
|
if (is_object(Globals::$mc)) {
|
723
|
|
|
Globals::$mc->setValues($this);
|
724
|
|
|
}
|
725
|
|
|
}
|
726
|
|
|
|
727
|
|
|
// We init log handlers
|
728
|
|
|
if (!empty(Globals::$conf->$global->SYSLOG_HANDLERS)) {
|
729
|
|
|
$handlers = json_decode(Globals::$conf->$global->SYSLOG_HANDLERS);
|
730
|
|
|
} else {
|
731
|
|
|
$handlers = array();
|
732
|
|
|
}
|
733
|
|
|
|
734
|
|
|
foreach ($handlers as $handler) {
|
735
|
|
|
$handler_files = array();
|
736
|
|
|
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $this->modules_parts['syslog']);
|
737
|
|
|
foreach ($dirsyslogs as $reldir) {
|
738
|
|
|
$dir = dol_buildpath($reldir, 0);
|
739
|
|
|
$newdir = dol_osencode($dir);
|
740
|
|
|
if (is_dir($newdir)) {
|
741
|
|
|
$file = $newdir . $handler . '.php';
|
742
|
|
|
if (file_exists($file)) {
|
743
|
|
|
$handler_files[] = $file;
|
744
|
|
|
}
|
745
|
|
|
}
|
746
|
|
|
}
|
747
|
|
|
|
748
|
|
|
if (empty($handler_files)) {
|
749
|
|
|
throw new Exception('Missing log handler file ' . $handler . '.php');
|
750
|
|
|
}
|
751
|
|
|
|
752
|
|
|
require_once $handler_files[0];
|
753
|
|
|
$loghandlerinstance = new $handler();
|
754
|
|
|
if (!$loghandlerinstance instanceof LogHandlerInterface) {
|
|
|
|
|
755
|
|
|
throw new Exception('Log handler does not extend LogHandlerInterface');
|
756
|
|
|
}
|
757
|
|
|
|
758
|
|
|
if (empty($this->loghandlers[$handler])) {
|
759
|
|
|
$this->loghandlers[$handler] = $loghandlerinstance;
|
760
|
|
|
}
|
761
|
|
|
}
|
762
|
|
|
}
|
763
|
|
|
}
|
764
|
|
|
|