| Conditions | 165 |
| Total Lines | 582 |
| Code Lines | 334 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 153 | public function setValues($db) |
||
| 154 | { |
||
| 155 | dol_syslog(get_class($this)."::setValues"); |
||
| 156 | |||
| 157 | //Define all global constants into $this->global->key=value |
||
| 158 | $sql = "SELECT ".$db->decrypt('name')." as name,"; |
||
| 159 | $sql .= " ".$db->decrypt('value')." as value, entity"; |
||
| 160 | $sql .= " FROM ".MAIN_DB_PREFIX."const"; |
||
| 161 | $sql .= " WHERE entity IN (0,".$this->entity.")"; |
||
| 162 | $sql .= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite. |
||
| 163 | |||
| 164 | $resql = $db->query($sql); |
||
| 165 | if ($resql) |
||
| 166 | { |
||
| 167 | $i = 0; |
||
| 168 | $numr = $db->num_rows($resql); |
||
| 169 | while ($i < $numr) |
||
| 170 | { |
||
| 171 | $objp = $db->fetch_object($resql); |
||
| 172 | $key = $objp->name; |
||
| 173 | $value = $objp->value; |
||
| 174 | if ($key) |
||
| 175 | { |
||
| 176 | // Allow constants values to be overridden by environment variables |
||
| 177 | if (isset($_SERVER['DOLIBARR_'.$key])) { |
||
| 178 | $value = $_SERVER['DOLIBARR_'.$key]; |
||
| 179 | } elseif (isset($_ENV['DOLIBARR_'.$key])) { |
||
| 180 | $value = $_ENV['DOLIBARR_'.$key]; |
||
| 181 | } |
||
| 182 | |||
| 183 | //if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install) |
||
| 184 | $this->global->$key = $value; |
||
| 185 | |||
| 186 | if ($value && strpos($key, 'MAIN_MODULE_') === 0) |
||
| 187 | { |
||
| 188 | $reg = array(); |
||
| 189 | // If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs']. |
||
| 190 | if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) |
||
| 191 | { |
||
| 192 | $partname = 'tabs'; |
||
| 193 | $params = explode(':', $value, 2); |
||
| 194 | if (!is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); } |
||
| 195 | $this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array |
||
| 196 | } |
||
| 197 | // If this is constant for all generic part activated by a module. It initializes |
||
| 198 | // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'], |
||
| 199 | // modules_parts['models'], modules_parts['theme'] |
||
| 200 | // modules_parts['sms'], |
||
| 201 | // modules_parts['css'], ... |
||
| 202 | elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) |
||
| 203 | { |
||
| 204 | $modulename = strtolower($reg[1]); |
||
| 205 | $partname = strtolower($reg[2]); |
||
| 206 | if (!is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); } |
||
| 207 | $arrValue = json_decode($value, true); |
||
| 208 | if (is_array($arrValue) && !empty($arrValue)) $value = $arrValue; |
||
| 209 | elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; |
||
| 210 | elseif (in_array($partname, array('models', 'theme'))) $value = '/'.$modulename.'/'; |
||
| 211 | elseif (in_array($partname, array('sms'))) $value = '/'.$modulename.'/'; |
||
| 212 | elseif ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe |
||
| 213 | $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array |
||
| 214 | } |
||
| 215 | // If this is a module constant (must be at end) |
||
| 216 | elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) |
||
| 217 | { |
||
| 218 | $modulename = strtolower($reg[1]); |
||
| 219 | if ($modulename == 'propale') $modulename = 'propal'; |
||
| 220 | if ($modulename == 'supplierproposal') $modulename = 'supplier_proposal'; |
||
| 221 | if (!isset($this->$modulename) || !is_object($this->$modulename)) $this->$modulename = new stdClass(); |
||
| 222 | $this->$modulename->enabled = true; |
||
| 223 | $this->modules[] = $modulename; // Add this module in list of enabled modules |
||
| 224 | } |
||
| 225 | } |
||
| 226 | } |
||
| 227 | $i++; |
||
| 228 | } |
||
| 229 | |||
| 230 | $db->free($resql); |
||
| 231 | } |
||
| 232 | |||
| 233 | // Include other local consts.php files and fetch their values to the corresponding database constants. |
||
| 234 | if (!empty($this->global->LOCAL_CONSTS_FILES)) { |
||
| 235 | $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); |
||
| 236 | foreach ($filesList as $file) { |
||
| 237 | $file = dol_sanitizeFileName($file); |
||
| 238 | include_once DOL_DOCUMENT_ROOT."/".$file."/".$file."_consts.php"; // This file can run code like setting $this->global->XXX vars. |
||
| 239 | } |
||
| 240 | } |
||
| 241 | |||
| 242 | //var_dump($this->modules); |
||
| 243 | //var_dump($this->modules_parts['theme']); |
||
| 244 | |||
| 245 | // If you can't set timezone of your PHP, set this constant. Better is to set it to UTC. |
||
| 246 | // In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore. |
||
| 247 | //$this->global->MAIN_SERVER_TZ='Europe/Paris'; |
||
| 248 | if (!empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') |
||
| 249 | { |
||
| 250 | try { |
||
| 251 | date_default_timezone_set($this->global->MAIN_SERVER_TZ); |
||
| 252 | } catch (Exception $e) |
||
| 253 | { |
||
| 254 | dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR); |
||
| 255 | } |
||
| 256 | } |
||
| 257 | |||
| 258 | // Object $mc |
||
| 259 | if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled)) { |
||
| 260 | global $mc; |
||
| 261 | $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php'); |
||
| 262 | if ($ret) { |
||
| 263 | $mc = new ActionsMulticompany($db); |
||
|
|
|||
| 264 | $this->mc = $mc; |
||
| 265 | } |
||
| 266 | } |
||
| 267 | |||
| 268 | // Clean some variables |
||
| 269 | if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD = "eldy_menu.php"; |
||
| 270 | if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD = "eldy_menu.php"; |
||
| 271 | if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones |
||
| 272 | if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE = "eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones |
||
| 273 | if (!isset($this->global->FACTURE_TVAOPTION)) $this->global->FACTURE_TVAOPTION = 1; |
||
| 274 | |||
| 275 | // Variable globales LDAP |
||
| 276 | if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME = ''; |
||
| 277 | if (!isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS = $this->global->LDAP_FIELD_FULLNAME; |
||
| 278 | if (!isset($this->global->LDAP_KEY_GROUPS)) $this->global->LDAP_KEY_GROUPS = $this->global->LDAP_FIELD_FULLNAME; |
||
| 279 | if (!isset($this->global->LDAP_KEY_CONTACTS)) $this->global->LDAP_KEY_CONTACTS = $this->global->LDAP_FIELD_FULLNAME; |
||
| 280 | if (!isset($this->global->LDAP_KEY_MEMBERS)) $this->global->LDAP_KEY_MEMBERS = $this->global->LDAP_FIELD_FULLNAME; |
||
| 281 | if (!isset($this->global->LDAP_KEY_MEMBERS_TYPES)) $this->global->LDAP_KEY_MEMBERS_TYPES = $this->global->LDAP_FIELD_FULLNAME; |
||
| 282 | |||
| 283 | // Load translation object with current language |
||
| 284 | if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT = "en_US"; |
||
| 285 | |||
| 286 | $rootfordata = DOL_DATA_ROOT; |
||
| 287 | $rootforuser = DOL_DATA_ROOT; |
||
| 288 | // If multicompany module is enabled, we redefine the root of data |
||
| 289 | if (!empty($this->multicompany->enabled) && !empty($this->entity) && $this->entity > 1) |
||
| 290 | { |
||
| 291 | $rootfordata .= '/'.$this->entity; |
||
| 292 | } |
||
| 293 | // Set standard temporary folder name or global override |
||
| 294 | $rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR; |
||
| 295 | |||
| 296 | // Define default dir_output and dir_temp for directories of modules |
||
| 297 | foreach ($this->modules as $module) |
||
| 298 | { |
||
| 299 | //var_dump($module); |
||
| 300 | // For multicompany sharings |
||
| 301 | $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module); |
||
| 302 | $this->$module->multidir_temp = array($this->entity => $rootfortemp."/".$module."/temp"); |
||
| 303 | // For backward compatibility |
||
| 304 | $this->$module->dir_output = $rootfordata."/".$module; |
||
| 305 | $this->$module->dir_temp = $rootfortemp."/".$module."/temp"; |
||
| 306 | } |
||
| 307 | |||
| 308 | // External modules storage |
||
| 309 | if (!empty($this->modules_parts['dir'])) |
||
| 310 | { |
||
| 311 | foreach ($this->modules_parts['dir'] as $module => $dirs) |
||
| 312 | { |
||
| 313 | if (!empty($this->$module->enabled)) |
||
| 314 | { |
||
| 315 | foreach ($dirs as $type => $name) // $type is 'output' or 'temp' |
||
| 316 | { |
||
| 317 | $multidirname = 'multidir_'.$type; |
||
| 318 | $dirname = 'dir_'.$type; |
||
| 319 | |||
| 320 | if ($type != 'temp') |
||
| 321 | { |
||
| 322 | // For multicompany sharings |
||
| 323 | $this->$module->$multidirname = array($this->entity => $rootfordata."/".$name); |
||
| 324 | |||
| 325 | // For backward compatibility |
||
| 326 | $this->$module->$dirname = $rootfordata."/".$name; |
||
| 327 | } else { |
||
| 328 | // For multicompany sharings |
||
| 329 | $this->$module->$multidirname = array($this->entity => $rootfortemp."/".$name."/temp"); |
||
| 330 | |||
| 331 | // For backward compatibility |
||
| 332 | $this->$module->$dirname = $rootfortemp."/".$name."/temp"; |
||
| 333 | } |
||
| 334 | } |
||
| 335 | } |
||
| 336 | } |
||
| 337 | } |
||
| 338 | |||
| 339 | // For mycompany storage |
||
| 340 | $this->mycompany->dir_output = $rootfordata."/mycompany"; |
||
| 341 | $this->mycompany->dir_temp = $rootfortemp."/mycompany/temp"; |
||
| 342 | |||
| 343 | // For admin storage |
||
| 344 | $this->admin->dir_output = $rootfordata.'/admin'; |
||
| 345 | $this->admin->dir_temp = $rootfortemp.'/admin/temp'; |
||
| 346 | |||
| 347 | // For user storage |
||
| 348 | $this->user->multidir_output = array($this->entity => $rootfordata."/users"); |
||
| 349 | $this->user->multidir_temp = array($this->entity => $rootfortemp."/users/temp"); |
||
| 350 | // For backward compatibility |
||
| 351 | $this->user->dir_output = $rootforuser."/users"; |
||
| 352 | $this->user->dir_temp = $rootfortemp."/users/temp"; |
||
| 353 | |||
| 354 | // For usergroup storage |
||
| 355 | $this->usergroup->dir_output = $rootforuser."/usergroups"; |
||
| 356 | $this->usergroup->dir_temp = $rootfortemp."/usergroups/temp"; |
||
| 357 | |||
| 358 | // For proposal storage |
||
| 359 | $this->propal->multidir_output = array($this->entity => $rootfordata."/propale"); |
||
| 360 | $this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp"); |
||
| 361 | // For backward compatibility |
||
| 362 | $this->propal->dir_output = $rootfordata."/propale"; |
||
| 363 | $this->propal->dir_temp = $rootfortemp."/propale/temp"; |
||
| 364 | |||
| 365 | // For medias storage |
||
| 366 | $this->medias->multidir_output = array($this->entity => $rootfordata."/medias"); |
||
| 367 | $this->medias->multidir_temp = array($this->entity => $rootfortemp."/medias/temp"); |
||
| 368 | |||
| 369 | // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. |
||
| 370 | |||
| 371 | // Sous module bons d'expedition |
||
| 372 | $this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0); |
||
| 373 | // Sous module bons de livraison |
||
| 374 | $this->livraison_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0); |
||
| 375 | |||
| 376 | // Module fournisseur |
||
| 377 | if (!empty($this->fournisseur)) |
||
| 378 | { |
||
| 379 | $this->fournisseur->commande = new stdClass(); |
||
| 380 | $this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande"); |
||
| 381 | $this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp"); |
||
| 382 | $this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility |
||
| 383 | $this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility |
||
| 384 | |||
| 385 | $this->fournisseur->facture = new stdClass(); |
||
| 386 | $this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture"); |
||
| 387 | $this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp"); |
||
| 388 | $this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility |
||
| 389 | $this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility |
||
| 390 | |||
| 391 | $this->supplierproposal = new stdClass(); |
||
| 392 | $this->supplierproposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal"); |
||
| 393 | $this->supplierproposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp"); |
||
| 394 | $this->supplierproposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility |
||
| 395 | $this->supplierproposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility |
||
| 396 | |||
| 397 | $this->fournisseur->payment = new stdClass(); |
||
| 398 | $this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment"); |
||
| 399 | $this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp"); |
||
| 400 | $this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility |
||
| 401 | $this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility |
||
| 402 | |||
| 403 | // To prepare split of module fournisseur into module 'fournisseur' + supplier_order + supplier_invoice |
||
| 404 | if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, and we don't use yet the new modules, we set artificialy the module properties |
||
| 405 | { |
||
| 406 | $this->supplier_order = new stdClass(); |
||
| 407 | $this->supplier_order->enabled = 1; |
||
| 408 | $this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande"); |
||
| 409 | $this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp"); |
||
| 410 | $this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility |
||
| 411 | $this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility |
||
| 412 | |||
| 413 | $this->supplier_invoice = new stdClass(); |
||
| 414 | $this->supplier_invoice->enabled = 1; |
||
| 415 | $this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture"); |
||
| 416 | $this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp"); |
||
| 417 | $this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility |
||
| 418 | $this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility |
||
| 419 | } |
||
| 420 | } |
||
| 421 | |||
| 422 | // Module product/service |
||
| 423 | $this->product->multidir_output = array($this->entity => $rootfordata."/produit"); |
||
| 424 | $this->product->multidir_temp = array($this->entity => $rootfortemp."/produit/temp"); |
||
| 425 | $this->service->multidir_output = array($this->entity => $rootfordata."/produit"); |
||
| 426 | $this->service->multidir_temp = array($this->entity => $rootfortemp."/produit/temp"); |
||
| 427 | // For backward compatibility |
||
| 428 | $this->product->dir_output = $rootfordata."/produit"; |
||
| 429 | $this->product->dir_temp = $rootfortemp."/produit/temp"; |
||
| 430 | $this->service->dir_output = $rootfordata."/produit"; |
||
| 431 | $this->service->dir_temp = $rootfortemp."/produit/temp"; |
||
| 432 | |||
| 433 | // Module productbatch |
||
| 434 | $this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot"); |
||
| 435 | $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/produitlot/temp"); |
||
| 436 | |||
| 437 | // Module contrat |
||
| 438 | $this->contrat->multidir_output = array($this->entity => $rootfordata."/contract"); |
||
| 439 | $this->contrat->multidir_temp = array($this->entity => $rootfortemp."/contract/temp"); |
||
| 440 | // For backward compatibility |
||
| 441 | $this->contrat->dir_output = $rootfordata."/contract"; |
||
| 442 | $this->contrat->dir_temp = $rootfortemp."/contract/temp"; |
||
| 443 | |||
| 444 | // Module bank |
||
| 445 | $this->bank->multidir_output = array($this->entity => $rootfordata."/bank"); |
||
| 446 | $this->bank->multidir_temp = array($this->entity => $rootfortemp."/bank/temp"); |
||
| 447 | // For backward compatibility |
||
| 448 | $this->bank->dir_output = $rootfordata."/bank"; |
||
| 449 | $this->bank->dir_temp = $rootfortemp."/bank/temp"; |
||
| 450 | |||
| 451 | // Set some default values |
||
| 452 | //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month |
||
| 453 | $this->global->MAIN_MAIL_USE_MULTI_PART = 1; |
||
| 454 | |||
| 455 | // societe |
||
| 456 | if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON = "mod_codeclient_leopard"; |
||
| 457 | if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON = "mod_codecompta_panicum"; |
||
| 458 | |||
| 459 | if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipt_mint'; |
||
| 460 | if (empty($this->global->TICKET_ADDON)) $this->global->TICKET_ADDON = 'mod_ticket_simple'; |
||
| 461 | |||
| 462 | // Security |
||
| 463 | if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED = 'standard'; // Default password generator |
||
| 464 | if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK = '0664'; // Default mask |
||
| 465 | |||
| 466 | // conf->use_javascript_ajax |
||
| 467 | $this->use_javascript_ajax = 1; |
||
| 468 | if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax = !$this->global->MAIN_DISABLE_JAVASCRIPT; |
||
| 469 | // If no javascript_ajax, Ajax features are disabled. |
||
| 470 | if (empty($this->use_javascript_ajax)) |
||
| 471 | { |
||
| 472 | unset($this->global->PRODUIT_USE_SEARCH_TO_SELECT); |
||
| 473 | unset($this->global->COMPANY_USE_SEARCH_TO_SELECT); |
||
| 474 | unset($this->global->CONTACT_USE_SEARCH_TO_SELECT); |
||
| 475 | unset($this->global->PROJECT_USE_SEARCH_TO_SELECT); |
||
| 476 | } |
||
| 477 | |||
| 478 | if (!empty($this->productbatch->enabled)) |
||
| 479 | { |
||
| 480 | $this->global->STOCK_CALCULATE_ON_BILL = 0; |
||
| 481 | $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0; |
||
| 482 | $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; |
||
| 483 | $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0; |
||
| 484 | $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0; |
||
| 485 | $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0; |
||
| 486 | if (empty($this->reception->enabled)) { |
||
| 487 | $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1; |
||
| 488 | } |
||
| 489 | else { |
||
| 490 | $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; |
||
| 491 | $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0; |
||
| 492 | } |
||
| 493 | } |
||
| 494 | |||
| 495 | // conf->currency |
||
| 496 | if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE = 'EUR'; |
||
| 497 | $this->currency = $this->global->MAIN_MONNAIE; |
||
| 498 | |||
| 499 | if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure |
||
| 500 | |||
| 501 | // conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) |
||
| 502 | if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE = 'RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' |
||
| 503 | |||
| 504 | // By default, suppliers objects can be linked to all projects |
||
| 505 | if (!isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1; |
||
| 506 | |||
| 507 | // By default we enable feature to bill time spent |
||
| 508 | if (!isset($this->global->PROJECT_BILL_TIME_SPENT)) $this->global->PROJECT_BILL_TIME_SPENT = 1; |
||
| 509 | |||
| 510 | // MAIN_HTML_TITLE |
||
| 511 | if (!isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE = 'noapp,thirdpartynameonly,contactnameonly,projectnameonly'; |
||
| 512 | |||
| 513 | // conf->liste_limit = constante de taille maximale des listes |
||
| 514 | if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT = 25; |
||
| 515 | $this->liste_limit = $this->global->MAIN_SIZE_LISTE_LIMIT; |
||
| 516 | |||
| 517 | // conf->product->limit_size = constante de taille maximale des select de produit |
||
| 518 | if (!isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE = 1000; |
||
| 519 | $this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE; |
||
| 520 | |||
| 521 | // conf->theme et $this->css |
||
| 522 | if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME = "eldy"; |
||
| 523 | if (!empty($this->global->MAIN_FORCETHEME)) $this->global->MAIN_THEME = $this->global->MAIN_FORCETHEME; |
||
| 524 | $this->theme = $this->global->MAIN_THEME; |
||
| 525 | $this->css = "/theme/".$this->theme."/style.css.php"; |
||
| 526 | |||
| 527 | // conf->email_from = email pour envoi par dolibarr des mails automatiques |
||
| 528 | $this->email_from = "[email protected]"; |
||
| 529 | if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; |
||
| 530 | |||
| 531 | // conf->notification->email_from = email pour envoi par Dolibarr des notifications |
||
| 532 | $this->notification->email_from = $this->email_from; |
||
| 533 | if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM; |
||
| 534 | |||
| 535 | // conf->mailing->email_from = email pour envoi par Dolibarr des mailings |
||
| 536 | $this->mailing->email_from = $this->email_from; |
||
| 537 | if (!empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; |
||
| 538 | if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1; |
||
| 539 | |||
| 540 | // Format for date (used by default when not found or not searched in lang) |
||
| 541 | $this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) |
||
| 542 | $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags |
||
| 543 | $this->format_hour_short = "%H:%M"; |
||
| 544 | $this->format_hour_short_duration = "%H:%M"; |
||
| 545 | $this->format_date_text_short = "%d %b %Y"; |
||
| 546 | $this->format_date_text = "%d %B %Y"; |
||
| 547 | $this->format_date_hour_short = "%d/%m/%Y %H:%M"; |
||
| 548 | $this->format_date_hour_sec_short = "%d/%m/%Y %H:%M:%S"; |
||
| 549 | $this->format_date_hour_text_short = "%d %b %Y %H:%M"; |
||
| 550 | $this->format_date_hour_text = "%d %B %Y %H:%M"; |
||
| 551 | |||
| 552 | // Duration of workday |
||
| 553 | if (!isset($this->global->MAIN_DURATION_OF_WORKDAY)) $this->global->MAIN_DURATION_OF_WORKDAY = 86400; |
||
| 554 | |||
| 555 | // Limites decimales si non definie (peuvent etre egale a 0) |
||
| 556 | if (!isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT = 5; |
||
| 557 | if (!isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT = 2; |
||
| 558 | if (!isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN = 8; |
||
| 559 | |||
| 560 | // Default pdf option |
||
| 561 | if (!isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES = 1; // use dash between lines |
||
| 562 | if (!isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1; // allow html content into free footer text |
||
| 563 | |||
| 564 | // Default max file size for upload |
||
| 565 | $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024); |
||
| 566 | |||
| 567 | // By default, we propagate contacts |
||
| 568 | if (!isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN = '*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented) |
||
| 569 | |||
| 570 | // By default, we do not use the zip town table but the table of third parties |
||
| 571 | if (!isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY = 0; |
||
| 572 | |||
| 573 | // By default, we open card if one found |
||
| 574 | if (!isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1; |
||
| 575 | |||
| 576 | // By default, we show state code in combo list |
||
| 577 | if (!isset($this->global->MAIN_SHOW_STATE_CODE)) $this->global->MAIN_SHOW_STATE_CODE = 1; |
||
| 578 | |||
| 579 | // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) |
||
| 580 | if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; |
||
| 581 | |||
| 582 | // Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal" |
||
| 583 | if (!isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL = 'user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later. |
||
| 584 | if (!empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list |
||
| 585 | { |
||
| 586 | foreach ($this->modules_parts['moduleforexternal'] as $key=>$value) $this->global->MAIN_MODULES_FOR_EXTERNAL .= ",".$key; |
||
| 587 | } |
||
| 588 | |||
| 589 | // Enable select2 |
||
| 590 | if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT = 'select2'; |
||
| 591 | |||
| 592 | // Timeouts |
||
| 593 | if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT = 10; |
||
| 594 | if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT = 30; |
||
| 595 | |||
| 596 | // Set default variable to calculate VAT as if option tax_mode was 0 (standard) |
||
| 597 | if (empty($this->global->TAX_MODE_SELL_PRODUCT)) $this->global->TAX_MODE_SELL_PRODUCT = 'invoice'; |
||
| 598 | if (empty($this->global->TAX_MODE_BUY_PRODUCT)) $this->global->TAX_MODE_BUY_PRODUCT = 'invoice'; |
||
| 599 | if (empty($this->global->TAX_MODE_SELL_SERVICE)) $this->global->TAX_MODE_SELL_SERVICE = 'payment'; |
||
| 600 | if (empty($this->global->TAX_MODE_BUY_SERVICE)) $this->global->TAX_MODE_BUY_SERVICE = 'payment'; |
||
| 601 | |||
| 602 | // Delay before warnings |
||
| 603 | // Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx |
||
| 604 | if (isset($this->agenda)) { |
||
| 605 | $this->adherent->subscription = new stdClass(); |
||
| 606 | $this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? $this->global->MAIN_DELAY_MEMBERS : 0) * 86400; |
||
| 607 | } |
||
| 608 | if (isset($this->agenda)) { |
||
| 609 | $this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 86400; |
||
| 610 | } |
||
| 611 | if (isset($this->projet)) |
||
| 612 | { |
||
| 613 | $this->projet->warning_delay = (isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE) ? $this->global->MAIN_DELAY_PROJECT_TO_CLOSE : 7) * 86400; |
||
| 614 | $this->projet->task = new StdClass(); |
||
| 615 | $this->projet->task->warning_delay = (isset($this->global->MAIN_DELAY_TASKS_TODO) ? $this->global->MAIN_DELAY_TASKS_TODO : 7) * 86400; |
||
| 616 | } |
||
| 617 | |||
| 618 | if (isset($this->commande)) { |
||
| 619 | $this->commande->client = new stdClass(); |
||
| 620 | $this->commande->fournisseur = new stdClass(); |
||
| 621 | $this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 86400; |
||
| 622 | $this->commande->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS) ? $this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS : 7) * 86400; |
||
| 623 | } |
||
| 624 | if (isset($this->propal)) { |
||
| 625 | $this->propal->cloture = new stdClass(); |
||
| 626 | $this->propal->facturation = new stdClass(); |
||
| 627 | $this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 86400; |
||
| 628 | $this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 86400; |
||
| 629 | } |
||
| 630 | if (isset($this->facture)) { |
||
| 631 | $this->facture->client = new stdClass(); |
||
| 632 | $this->facture->fournisseur = new stdClass(); |
||
| 633 | $this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 86400; |
||
| 634 | $this->facture->fournisseur->warning_delay = (isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY) ? $this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY : 0) * 86400; |
||
| 635 | } |
||
| 636 | if (isset($this->contrat)) { |
||
| 637 | $this->contrat->services = new stdClass(); |
||
| 638 | $this->contrat->services->inactifs = new stdClass(); |
||
| 639 | $this->contrat->services->expires = new stdClass(); |
||
| 640 | $this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 86400; |
||
| 641 | $this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400; |
||
| 642 | } |
||
| 643 | if (isset($this->commande)) { |
||
| 644 | $this->bank->rappro = new stdClass(); |
||
| 645 | $this->bank->cheque = new stdClass(); |
||
| 646 | $this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400; |
||
| 647 | $this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400; |
||
| 648 | } |
||
| 649 | if (isset($this->expensereport)) { |
||
| 650 | $this->expensereport->approve = new stdClass(); |
||
| 651 | $this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 86400; |
||
| 652 | $this->expensereport->payment = new stdClass(); |
||
| 653 | $this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 86400; |
||
| 654 | } |
||
| 655 | if (isset($this->holiday)) { |
||
| 656 | $this->holiday->approve = new stdClass(); |
||
| 657 | $this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400; |
||
| 658 | } |
||
| 659 | |||
| 660 | if (!empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) |
||
| 661 | { |
||
| 662 | $this->global->PRODUIT_MULTIPRICES_LIMIT = 5; |
||
| 663 | } |
||
| 664 | |||
| 665 | // For modules that want to disable top or left menu |
||
| 666 | if (!empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu = $this->global->MAIN_HIDE_TOP_MENU; |
||
| 667 | if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu = $this->global->MAIN_HIDE_LEFT_MENU; |
||
| 668 | |||
| 669 | if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) $this->global->MAIN_SIZE_SHORTLIST_LIMIT = 3; |
||
| 670 | |||
| 671 | if (!isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT = 0; |
||
| 672 | |||
| 673 | // Save inconsistent option |
||
| 674 | if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (!isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO')) |
||
| 675 | { |
||
| 676 | $this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on. |
||
| 677 | } |
||
| 678 | |||
| 679 | if (!isset($this->global->MAIN_JS_GRAPH)) $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library |
||
| 680 | |||
| 681 | if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com'; |
||
| 682 | if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567'; |
||
| 683 | |||
| 684 | // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. |
||
| 685 | if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; |
||
| 686 | |||
| 687 | // For backward compatibility |
||
| 688 | if (isset($this->product)) $this->produit = $this->product; |
||
| 689 | if (isset($this->facture)) $this->invoice = $this->facture; |
||
| 690 | if (isset($this->commande)) $this->order = $this->commande; |
||
| 691 | if (isset($this->contrat)) $this->contract = $this->contrat; |
||
| 692 | if (isset($this->categorie)) $this->category = $this->categorie; |
||
| 693 | if (isset($this->project)) $this->project = $this->projet; |
||
| 694 | |||
| 695 | // Object $mc |
||
| 696 | if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled)) |
||
| 697 | { |
||
| 698 | if (is_object($mc)) $mc->setValues($this); |
||
| 699 | } |
||
| 700 | |||
| 701 | if (!empty($this->syslog->enabled)) { |
||
| 702 | // We init log handlers |
||
| 703 | if (!empty($this->global->SYSLOG_HANDLERS)) { |
||
| 704 | $handlers = json_decode($this->global->SYSLOG_HANDLERS); |
||
| 705 | } else { |
||
| 706 | $handlers = array(); |
||
| 707 | } |
||
| 708 | foreach ($handlers as $handler) { |
||
| 709 | $handler_file_found = ''; |
||
| 710 | $dirsyslogs = array_merge(array('/core/modules/syslog/'), $this->modules_parts['syslog']); |
||
| 711 | foreach ($dirsyslogs as $reldir) { |
||
| 712 | $dir = dol_buildpath($reldir, 0); |
||
| 713 | $newdir = dol_osencode($dir); |
||
| 714 | if (is_dir($newdir)) { |
||
| 715 | $file = $newdir.$handler.'.php'; |
||
| 716 | if (file_exists($file)) { |
||
| 717 | $handler_file_found = $file; |
||
| 718 | break; |
||
| 719 | } |
||
| 720 | } |
||
| 721 | } |
||
| 722 | |||
| 723 | if (empty($handler_file_found)) { |
||
| 724 | throw new Exception('Missing log handler file '.$handler.'.php'); |
||
| 725 | } |
||
| 726 | |||
| 727 | require_once $handler_file_found; |
||
| 728 | $loghandlerinstance = new $handler(); |
||
| 729 | if (!$loghandlerinstance instanceof LogHandlerInterface) { |
||
| 730 | throw new Exception('Log handler does not extend LogHandlerInterface'); |
||
| 731 | } |
||
| 732 | |||
| 733 | if (empty($this->loghandlers[$handler])) { |
||
| 734 | $this->loghandlers[$handler] = $loghandlerinstance; |
||
| 735 | } |
||
| 740 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths