265 if (!empty($this->modules)) {
266 foreach ($this->modules as $m) {
267 if (isset($this->$m)) {
284 $this->fournisseur =
new stdClass();
296 $this->notification =
new stdClass();
297 $this->expensereport =
new stdClass();
298 $this->productbatch =
new stdClass();
301 $this->cache = array();
302 $this->modules = array();
303 $this->modules_parts = array(
307 'triggers' => array(),
309 'substitutions' => array(),
314 'barcode' => array(),
316 'societe' => array(),
323 if (!is_null($db) && is_object($db)) {
324 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
327 $sql =
"SELECT ".$db->decrypt(
'name').
" as name,";
328 $sql .=
" ".$db->decrypt(
'value').
" as value, entity";
329 $sql .=
" FROM ".$db->prefix().
"const";
330 $sql .=
" WHERE entity IN (0,".$this->entity.
")";
331 $sql .=
" ORDER BY entity";
333 $resql = $db->query($sql);
336 $numr = $db->num_rows($resql);
338 $objp = $db->fetch_object($resql);
340 $value = $objp->value;
343 if (isset($_SERVER[
'DOLIBARR_'.$key])) {
344 $value = $_SERVER[
'DOLIBARR_'.$key];
345 } elseif (isset($_ENV[
'DOLIBARR_'.$key])) {
346 $value = $_ENV[
'DOLIBARR_'.$key];
351 if ($value && strpos($key,
'MAIN_MODULE_') === 0) {
354 if (preg_match(
'/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) {
356 $params = explode(
':', $value, 2);
357 if (!is_array($this->modules_parts[$partname])) {
358 $this->modules_parts[$partname] = array();
360 $this->modules_parts[$partname][$params[0]][] = $value;
361 } elseif (preg_match(
'/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
368 $modulename = strtolower($reg[1]);
369 $partname = strtolower($reg[2]);
370 if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
371 $this->modules_parts[$partname] = array();
374 $arrValue = json_decode($value,
true);
376 if (is_array($arrValue)) {
377 $newvalue = $arrValue;
378 } elseif (in_array($partname, array(
'login',
'menus',
'substitutions',
'triggers',
'tpl'))) {
379 $newvalue =
'/'.$modulename.
'/core/'.$partname.
'/';
380 } elseif (in_array($partname, array(
'models',
'theme'))) {
381 $newvalue =
'/'.$modulename.
'/';
382 } elseif ($value == 1) {
383 $newvalue =
'/'.$modulename.
'/core/modules/'.$partname.
'/';
388 if (!empty($newvalue)) {
389 $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $newvalue));
391 } elseif (preg_match(
'/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
393 $modulename = strtolower($reg[1]);
394 if ($modulename ==
'propale') {
395 $modulename =
'propal';
397 if ($modulename ==
'supplierproposal') {
398 $modulename =
'supplier_proposal';
400 $this->modules[$modulename] = $modulename;
404 if (!isset($this->$modulename) || !is_object($this->$modulename)) {
405 $this->$modulename =
new stdClass();
407 $this->$modulename->enabled =
true;
419 if (!empty($this->global->LOCAL_CONSTS_FILES)) {
420 $filesList = explode(
":", $this->global->LOCAL_CONSTS_FILES);
421 foreach ($filesList as $file) {
433 if (!empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ !=
'auto') {
435 date_default_timezone_set($this->global->MAIN_SERVER_TZ);
437 dol_syslog(
"Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR);
442 if (!defined(
'NOREQUIREMC') && isModEnabled(
'multicompany')) {
444 $ret = @
dol_include_once(
'/multicompany/class/actions_multicompany.class.php');
445 if ($ret && class_exists(
'ActionsMulticompany')) {
446 $mc =
new ActionsMulticompany($db);
451 if (empty($this->global->MAIN_MENU_STANDARD)) {
452 $this->global->MAIN_MENU_STANDARD =
"eldy_menu.php";
454 if (empty($this->global->MAIN_MENUFRONT_STANDARD)) {
455 $this->global->MAIN_MENUFRONT_STANDARD =
"eldy_menu.php";
457 if (empty($this->global->MAIN_MENU_SMARTPHONE)) {
458 $this->global->MAIN_MENU_SMARTPHONE =
"eldy_menu.php";
460 if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) {
461 $this->global->MAIN_MENUFRONT_SMARTPHONE =
"eldy_menu.php";
463 if (!isset($this->global->FACTURE_TVAOPTION)) {
464 $this->global->FACTURE_TVAOPTION = 1;
468 if (empty($this->global->LDAP_FIELD_FULLNAME)) {
469 $this->global->LDAP_FIELD_FULLNAME =
'';
471 if (!isset($this->global->LDAP_KEY_USERS)) {
472 $this->global->LDAP_KEY_USERS = $this->global->LDAP_FIELD_FULLNAME;
474 if (!isset($this->global->LDAP_KEY_GROUPS)) {
475 $this->global->LDAP_KEY_GROUPS = $this->global->LDAP_FIELD_FULLNAME;
477 if (!isset($this->global->LDAP_KEY_CONTACTS)) {
478 $this->global->LDAP_KEY_CONTACTS = $this->global->LDAP_FIELD_FULLNAME;
480 if (!isset($this->global->LDAP_KEY_MEMBERS)) {
481 $this->global->LDAP_KEY_MEMBERS = $this->global->LDAP_FIELD_FULLNAME;
483 if (!isset($this->global->LDAP_KEY_MEMBERS_TYPES)) {
484 $this->global->LDAP_KEY_MEMBERS_TYPES = $this->global->LDAP_FIELD_FULLNAME;
488 if (empty($this->global->MAIN_LANG_DEFAULT)) {
489 $this->global->MAIN_LANG_DEFAULT =
"en_US";
492 $rootfordata = DOL_DATA_ROOT;
493 $rootforuser = DOL_DATA_ROOT;
495 if (isModEnabled(
'multicompany') && !empty($this->entity) && $this->entity > 1) {
496 $rootfordata .=
'/'.$this->entity;
499 $rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR;
502 foreach ($this->modules as $module) {
505 $this->$module->multidir_output = array($this->entity => $rootfordata.
"/".$module);
506 $this->$module->multidir_temp = array($this->entity => $rootfortemp.
"/".$module.
"/temp");
508 $this->$module->dir_output = $rootfordata.
"/".$module;
509 $this->$module->dir_temp = $rootfortemp.
"/".$module.
"/temp";
513 if (!empty($this->modules_parts[
'dir'])) {
514 foreach ($this->modules_parts[
'dir'] as $module => $dirs) {
515 if (!empty($this->$module->enabled)) {
516 foreach ($dirs as $type => $name) {
517 $multidirname =
'multidir_'.$type;
518 $dirname =
'dir_'.$type;
520 if ($type !=
'temp') {
522 $this->$module->$multidirname = array($this->entity => $rootfordata.
"/".$name);
525 $this->$module->$dirname = $rootfordata.
"/".$name;
528 $this->$module->$multidirname = array($this->entity => $rootfortemp.
"/".$name.
"/temp");
531 $this->$module->$dirname = $rootfortemp.
"/".$name.
"/temp";
539 $this->mycompany->multidir_output = array($this->entity => $rootfordata.
"/mycompany");
540 $this->mycompany->multidir_temp = array($this->entity => $rootfortemp.
"/mycompany/temp");
542 $this->mycompany->dir_output = $rootfordata.
"/mycompany";
543 $this->mycompany->dir_temp = $rootfortemp.
"/mycompany/temp";
546 $this->admin->dir_output = $rootfordata.
'/admin';
547 $this->admin->dir_temp = $rootfortemp.
'/admin/temp';
550 $this->
user->multidir_output = array($this->entity => $rootfordata.
"/users");
551 $this->
user->multidir_temp = array($this->entity => $rootfortemp.
"/users/temp");
553 $this->
user->dir_output = $rootforuser.
"/users";
554 $this->
user->dir_temp = $rootfortemp.
"/users/temp";
557 $this->propal->multidir_output = array($this->entity => $rootfordata.
"/propale");
558 $this->propal->multidir_temp = array($this->entity => $rootfortemp.
"/propale/temp");
560 $this->propal->dir_output = $rootfordata.
"/propale";
561 $this->propal->dir_temp = $rootfortemp.
"/propale/temp";
564 $this->medias->multidir_output = array($this->entity => $rootfordata.
"/medias");
565 $this->medias->multidir_temp = array($this->entity => $rootfortemp.
"/medias/temp");
570 if (!empty($this->fournisseur)) {
571 $this->fournisseur->commande =
new stdClass();
572 $this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata.
"/fournisseur/commande");
573 $this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp.
"/fournisseur/commande/temp");
574 $this->fournisseur->commande->dir_output = $rootfordata.
"/fournisseur/commande";
575 $this->fournisseur->commande->dir_temp = $rootfortemp.
"/fournisseur/commande/temp";
577 $this->fournisseur->facture =
new stdClass();
578 $this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata.
"/fournisseur/facture");
579 $this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp.
"/fournisseur/facture/temp");
580 $this->fournisseur->facture->dir_output = $rootfordata.
"/fournisseur/facture";
581 $this->fournisseur->facture->dir_temp = $rootfortemp.
"/fournisseur/facture/temp";
583 $this->supplier_proposal =
new stdClass();
584 $this->supplier_proposal->multidir_output = array($this->entity => $rootfordata.
"/supplier_proposal");
585 $this->supplier_proposal->multidir_temp = array($this->entity => $rootfortemp.
"/supplier_proposal/temp");
586 $this->supplier_proposal->dir_output = $rootfordata.
"/supplier_proposal";
587 $this->supplier_proposal->dir_temp = $rootfortemp.
"/supplier_proposal/temp";
589 $this->fournisseur->payment =
new stdClass();
590 $this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata.
"/fournisseur/payment");
591 $this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp.
"/fournisseur/payment/temp");
592 $this->fournisseur->payment->dir_output = $rootfordata.
"/fournisseur/payment";
593 $this->fournisseur->payment->dir_temp = $rootfortemp.
"/fournisseur/payment/temp";
596 if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) {
597 $this->supplier_order =
new stdClass();
598 $this->supplier_order->enabled = 1;
599 $this->supplier_order->multidir_output = array($this->entity => $rootfordata.
"/fournisseur/commande");
600 $this->supplier_order->multidir_temp = array($this->entity => $rootfortemp.
"/fournisseur/commande/temp");
601 $this->supplier_order->dir_output = $rootfordata.
"/fournisseur/commande";
602 $this->supplier_order->dir_temp = $rootfortemp.
"/fournisseur/commande/temp";
604 $this->supplier_invoice =
new stdClass();
605 $this->supplier_invoice->enabled = 1;
606 $this->supplier_invoice->multidir_output = array($this->entity => $rootfordata.
"/fournisseur/facture");
607 $this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp.
"/fournisseur/facture/temp");
608 $this->supplier_invoice->dir_output = $rootfordata.
"/fournisseur/facture";
609 $this->supplier_invoice->dir_temp = $rootfortemp.
"/fournisseur/facture/temp";
614 $this->product->multidir_output = array($this->entity => $rootfordata.
"/produit");
615 $this->product->multidir_temp = array($this->entity => $rootfortemp.
"/produit/temp");
616 $this->service->multidir_output = array($this->entity => $rootfordata.
"/produit");
617 $this->service->multidir_temp = array($this->entity => $rootfortemp.
"/produit/temp");
619 $this->product->dir_output = $rootfordata.
"/produit";
620 $this->product->dir_temp = $rootfortemp.
"/produit/temp";
621 $this->service->dir_output = $rootfordata.
"/produit";
622 $this->service->dir_temp = $rootfortemp.
"/produit/temp";
625 $this->productbatch->multidir_output = array($this->entity => $rootfordata.
"/productlot");
626 $this->productbatch->multidir_temp = array($this->entity => $rootfortemp.
"/productlot/temp");
629 $this->contrat->multidir_output = array($this->entity => $rootfordata.
"/contract");
630 $this->contrat->multidir_temp = array($this->entity => $rootfortemp.
"/contract/temp");
632 $this->contrat->dir_output = $rootfordata.
"/contract";
633 $this->contrat->dir_temp = $rootfortemp.
"/contract/temp";
636 $this->bank->multidir_output = array($this->entity => $rootfordata.
"/bank");
637 $this->bank->multidir_temp = array($this->entity => $rootfortemp.
"/bank/temp");
639 $this->bank->dir_output = $rootfordata.
"/bank";
640 $this->bank->dir_temp = $rootfortemp.
"/bank/temp";
644 $this->global->MAIN_MAIL_USE_MULTI_PART = 1;
647 if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) {
648 $this->global->SOCIETE_CODECLIENT_ADDON =
"mod_codeclient_leopard";
650 if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) {
651 $this->global->SOCIETE_CODECOMPTA_ADDON =
"mod_codecompta_panicum";
654 if (empty($this->global->CHEQUERECEIPTS_ADDON)) {
655 $this->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipt_mint';
657 if (empty($this->global->TICKET_ADDON)) {
658 $this->global->TICKET_ADDON =
'mod_ticket_simple';
662 if (empty($this->global->USER_PASSWORD_GENERATED)) {
663 $this->global->USER_PASSWORD_GENERATED =
'standard';
665 if (empty($this->global->MAIN_UMASK)) {
666 $this->global->MAIN_UMASK =
'0660';
669 $tmpumask = (octdec($this->global->MAIN_UMASK) & 0666);
670 $tmpumask = decoct($tmpumask);
671 if (!preg_match(
'/^0/', $tmpumask)) {
672 $tmpumask =
'0'.$tmpumask;
674 if (empty($tmpumask) || $tmpumask ===
'0') {
677 $this->global->MAIN_UMASK = $tmpumask;
681 $this->use_javascript_ajax = 1;
682 if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) {
683 $this->use_javascript_ajax = !$this->global->MAIN_DISABLE_JAVASCRIPT;
686 if (empty($this->use_javascript_ajax)) {
687 unset($this->global->PRODUIT_USE_SEARCH_TO_SELECT);
688 unset($this->global->COMPANY_USE_SEARCH_TO_SELECT);
689 unset($this->global->CONTACT_USE_SEARCH_TO_SELECT);
690 unset($this->global->PROJECT_USE_SEARCH_TO_SELECT);
693 if (isModEnabled(
'productbatch')) {
695 $this->global->STOCK_CALCULATE_ON_BILL = 0;
696 $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
697 if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) {
698 $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1;
700 if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
701 $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
703 $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
704 $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
705 if (!isModEnabled(
'reception')) {
706 $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
708 if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) {
709 $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1;
711 if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
712 $this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
717 if (!isset($this->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT)) {
718 $this->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT = 1;
722 if (empty($this->global->MAIN_MONNAIE)) {
723 $this->global->MAIN_MONNAIE =
'EUR';
725 $this->currency = $this->global->MAIN_MONNAIE;
727 if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) {
728 $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30;
732 if (empty($this->global->ACCOUNTING_MODE)) {
733 $this->global->ACCOUNTING_MODE =
'RECETTES-DEPENSES';
736 if (!isset($this->global->MAIN_ENABLE_AJAX_TOOLTIP)) {
737 $this->global->MAIN_ENABLE_AJAX_TOOLTIP = 0;
741 if (!isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) {
742 $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
746 if (!isset($this->global->PROJECT_BILL_TIME_SPENT)) {
747 $this->global->PROJECT_BILL_TIME_SPENT = 1;
751 if (!isset($this->global->MAIN_HTML_TITLE)) {
752 $this->global->MAIN_HTML_TITLE =
'noapp,thirdpartynameonly,contactnameonly,projectnameonly';
756 if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) {
757 $this->global->MAIN_SIZE_LISTE_LIMIT = 15;
759 $this->liste_limit = $this->global->MAIN_SIZE_LISTE_LIMIT;
762 if (!isset($this->global->PRODUIT_LIMIT_SIZE)) {
763 $this->global->PRODUIT_LIMIT_SIZE = 1000;
765 $this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE;
768 $this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = (isset($this->global->PRODUIT_DESC_IN_FORM) ? $this->global->PRODUIT_DESC_IN_FORM : 0);
771 if (empty($this->global->MAIN_THEME)) {
772 $this->global->MAIN_THEME =
"eldy";
774 if (!empty($this->global->MAIN_FORCETHEME)) {
775 $this->global->MAIN_THEME = $this->global->MAIN_FORCETHEME;
777 $this->theme = $this->global->MAIN_THEME;
778 $this->css =
"/theme/".$this->theme.
"/style.css.php";
781 $this->email_from =
"robot@example.com";
782 if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) {
783 $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
787 if (isModEnabled(
'notification')) {
788 $this->notification->email_from = $this->email_from;
789 if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) {
790 $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM;
794 if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
795 $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1;
798 if (!isset($this->global->MAIN_FIX_FOR_BUGGED_MTA)) {
799 $this->global->MAIN_FIX_FOR_BUGGED_MTA = 1;
803 $this->format_date_short =
"%d/%m/%Y";
804 $this->format_date_short_java =
"dd/MM/yyyy";
805 $this->format_hour_short =
"%H:%M";
806 $this->format_hour_short_duration =
"%H:%M";
807 $this->format_date_text_short =
"%d %b %Y";
808 $this->format_date_text =
"%d %B %Y";
809 $this->format_date_hour_short =
"%d/%m/%Y %H:%M";
810 $this->format_date_hour_sec_short =
"%d/%m/%Y %H:%M:%S";
811 $this->format_date_hour_text_short =
"%d %b %Y %H:%M";
812 $this->format_date_hour_text =
"%d %B %Y %H:%M";
815 if (!isset($this->global->MAIN_DURATION_OF_WORKDAY)) {
816 $this->global->MAIN_DURATION_OF_WORKDAY = 86400;
820 if (!isset($this->global->MAIN_MAX_DECIMALS_UNIT)) {
821 $this->global->MAIN_MAX_DECIMALS_UNIT = 5;
823 if (!isset($this->global->MAIN_MAX_DECIMALS_TOT)) {
824 $this->global->MAIN_MAX_DECIMALS_TOT = 2;
826 if (!isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) {
827 $this->global->MAIN_MAX_DECIMALS_SHOWN = 8;
831 if (!isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) {
832 $this->global->MAIN_PDF_DASH_BETWEEN_LINES = 1;
834 if (!isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
835 $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1;
842 if (!isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) {
843 $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN =
'*';
847 if (!isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) {
848 $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY = 0;
852 if (!isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) {
853 $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE = 1;
857 if (!isset($this->global->MAIN_SHOW_STATE_CODE)) {
858 $this->global->MAIN_SHOW_STATE_CODE = 1;
862 if (!isset($this->global->MULTICURRENCY_USE_ORIGIN_TX)) {
863 $this->global->MULTICURRENCY_USE_ORIGIN_TX = 1;
867 if (!isset($this->global->USE_STRICT_CSV_RULES)) {
868 $this->global->USE_STRICT_CSV_RULES = 2;
872 if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
873 $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
877 if (!isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) {
878 $this->global->MAIN_MODULES_FOR_EXTERNAL =
'user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,reception,agenda,resource,adherent,blockedlog';
880 if (!empty($this->modules_parts[
'moduleforexternal'])) {
881 foreach ($this->modules_parts[
'moduleforexternal'] as $key => $value) {
882 $this->global->MAIN_MODULES_FOR_EXTERNAL .=
",".$key;
887 if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT ==
'1') {
888 $this->global->MAIN_USE_JQUERY_MULTISELECT =
'select2';
892 if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) {
893 $this->global->MAIN_USE_CONNECT_TIMEOUT = 10;
895 if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) {
896 $this->global->MAIN_USE_RESPONSE_TIMEOUT = 30;
900 if (empty($this->global->TAX_MODE_SELL_PRODUCT)) {
901 $this->global->TAX_MODE_SELL_PRODUCT =
'invoice';
903 if (empty($this->global->TAX_MODE_BUY_PRODUCT)) {
904 $this->global->TAX_MODE_BUY_PRODUCT =
'invoice';
906 if (empty($this->global->TAX_MODE_SELL_SERVICE)) {
907 $this->global->TAX_MODE_SELL_SERVICE =
'payment';
909 if (empty($this->global->TAX_MODE_BUY_SERVICE)) {
910 $this->global->TAX_MODE_BUY_SERVICE =
'payment';
915 if (isset($this->agenda)) {
916 $this->adherent->subscription =
new stdClass();
917 $this->adherent->subscription->warning_delay = (isset($this->global->MAIN_DELAY_MEMBERS) ? (int) $this->global->MAIN_DELAY_MEMBERS : 0) * 86400;
919 if (isset($this->agenda)) {
920 $this->agenda->warning_delay = (isset($this->global->MAIN_DELAY_ACTIONS_TODO) ? (int) $this->global->MAIN_DELAY_ACTIONS_TODO : 7) * 86400;
922 if (isset($this->projet)) {
923 $this->projet->warning_delay = (
getDolGlobalInt(
'MAIN_DELAY_PROJECT_TO_CLOSE', 7) * 86400);
924 $this->projet->task =
new StdClass();
925 $this->projet->task->warning_delay = (
getDolGlobalInt(
'MAIN_DELAY_TASKS_TODO', 7) * 86400);
928 if (isset($this->commande)) {
929 $this->commande->client =
new stdClass();
930 $this->commande->fournisseur =
new stdClass();
931 $this->commande->client->warning_delay = (isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS) ? (int) $this->global->MAIN_DELAY_ORDERS_TO_PROCESS : 2) * 86400;
932 $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;
934 if (isset($this->propal)) {
935 $this->propal->cloture =
new stdClass();
936 $this->propal->facturation =
new stdClass();
937 $this->propal->cloture->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_CLOSE : 0) * 86400;
938 $this->propal->facturation->warning_delay = (isset($this->global->MAIN_DELAY_PROPALS_TO_BILL) ? (int) $this->global->MAIN_DELAY_PROPALS_TO_BILL : 0) * 86400;
940 if (isset($this->facture)) {
941 $this->facture->client =
new stdClass();
942 $this->facture->fournisseur =
new stdClass();
943 $this->facture->client->warning_delay = (isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED) ? (int) $this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED : 0) * 86400;
944 $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;
946 if (isset($this->contrat)) {
947 $this->contrat->services =
new stdClass();
948 $this->contrat->services->inactifs =
new stdClass();
949 $this->contrat->services->expires =
new stdClass();
950 $this->contrat->services->inactifs->warning_delay = (isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES) ? (int) $this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES : 0) * 86400;
951 $this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? (int) $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400;
953 if (isset($this->commande)) {
954 $this->bank->rappro =
new stdClass();
955 $this->bank->cheque =
new stdClass();
956 $this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? (int) $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400;
957 $this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? (int) $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400;
959 if (isset($this->expensereport)) {
960 $this->expensereport->approve =
new stdClass();
961 $this->expensereport->approve->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS : 0) * 86400;
962 $this->expensereport->payment =
new stdClass();
963 $this->expensereport->payment->warning_delay = (isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY) ? (int) $this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY : 0) * 86400;
965 if (isset($this->holiday)) {
966 $this->holiday->approve =
new stdClass();
967 $this->holiday->approve->warning_delay = (isset($this->global->MAIN_DELAY_HOLIDAYS) ? (int) $this->global->MAIN_DELAY_HOLIDAYS : 0) * 86400;
970 if (!empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) {
971 $this->global->PRODUIT_MULTIPRICES_LIMIT = 5;
975 if (!empty($this->global->MAIN_HIDE_TOP_MENU)) {
976 $this->dol_hide_topmenu = $this->global->MAIN_HIDE_TOP_MENU;
978 if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) {
979 $this->dol_hide_leftmenu = $this->global->MAIN_HIDE_LEFT_MENU;
982 if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) {
983 $this->global->MAIN_SIZE_SHORTLIST_LIMIT = 3;
987 if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (!isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE ==
'AC_NON_AUTO')) {
988 $this->global->AGENDA_DEFAULT_FILTER_TYPE =
'0';
991 if (!isset($this->global->MAIN_JS_GRAPH)) {
992 $this->global->MAIN_JS_GRAPH =
'chart';
995 if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) {
996 $this->global->MAIN_MODULE_DOLISTORE_API_SRV =
'https://www.dolistore.com';
998 if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) {
999 $this->global->MAIN_MODULE_DOLISTORE_API_KEY =
'dolistorecatalogpublickey1234567';
1003 if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) {
1007 $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 2;
1011 if (!isset($this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA)) {
1012 $this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA = 1;
1015 if (!isset($this->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
1016 $this->global->MAIL_SMTP_USE_FROM_FOR_HELO = 2;
1019 if (!defined(
'MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
1020 if (defined(
'MAIN_ANTIVIRUS_COMMAND')) {
1021 $this->global->MAIN_ANTIVIRUS_COMMAND = constant(
'MAIN_ANTIVIRUS_COMMAND');
1023 if (defined(
'MAIN_ANTIVIRUS_PARAM')) {
1024 $this->global->MAIN_ANTIVIRUS_PARAM = constant(
'MAIN_ANTIVIRUS_PARAM');
1029 if (!empty($this->global->LDAP_SYNCHRO_ACTIVE)) {
1030 if ($this->global->LDAP_SYNCHRO_ACTIVE ==
'dolibarr2ldap') {
1031 $this->global->LDAP_SYNCHRO_ACTIVE = 1;
1032 } elseif ($this->global->LDAP_SYNCHRO_ACTIVE ==
'ldap2dolibarr') {
1033 $this->global->LDAP_SYNCHRO_ACTIVE = 2;
1037 if (!empty($this->global->LDAP_MEMBER_ACTIVE) && $this->global->LDAP_MEMBER_ACTIVE ==
'ldap2dolibarr') {
1038 $this->global->LDAP_MEMBER_ACTIVE = 2;
1041 if (!empty($this->global->LDAP_MEMBER_TYPE_ACTIVE) && $this->global->LDAP_MEMBER_TYPE_ACTIVE ==
'ldap2dolibarr') {
1042 $this->global->LDAP_MEMBER_TYPE_ACTIVE = 2;
1045 if (!empty($this->global->MAIN_TZUSERINPUTKEY)) {
1046 $this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY;
1049 if (!empty($this->global->PRODUIT_AUTOFILL_DESC)) {
1050 $this->global->MAIN_NO_CONCAT_DESCRIPTION = 1;
1052 unset($this->global->MAIN_NO_CONCAT_DESCRIPTION);
1056 if (isset($this->product)) {
1058 $this->produit = $this->product;
1061 if (isset($this->facture)) {
1065 if (isset($this->commande)) {
1066 $this->order = $this->commande;
1069 if (isset($this->contrat)) {
1073 if (isset($this->categorie)) {
1074 $this->category = $this->categorie;
1077 if (isset($this->projet) && !isset($this->project)) {
1081 if (isset($this->adherent) && !isset($this->member)) {
1086 if (!defined(
'NOREQUIREMC') && isModEnabled(
'multicompany')) {
1087 if (is_object($mc)) {
1088 $mc->setValues($this);
1092 if (isModEnabled(
'syslog')) {
1094 if (!empty($this->global->SYSLOG_HANDLERS)) {
1095 $handlers = json_decode($this->global->SYSLOG_HANDLERS);
1097 $handlers = array();
1099 foreach ($handlers as $handler) {
1100 $handler_file_found =
'';
1101 $dirsyslogs = array(
'/core/modules/syslog/');
1102 if (!empty($this->modules_parts[
'syslog']) && is_array($this->modules_parts[
'syslog'])) {
1103 $dirsyslogs = array_merge($dirsyslogs, $this->modules_parts[
'syslog']);
1105 foreach ($dirsyslogs as $reldir) {
1108 if (is_dir($newdir)) {
1109 $file = $newdir.$handler.
'.php';
1110 if (file_exists($file)) {
1111 $handler_file_found = $file;
1117 if (empty($handler_file_found)) {
1123 require_once $handler_file_found;
1124 $loghandlerinstance =
new $handler();
1126 throw new Exception(
'Log handler does not extend LogHandlerInterface');
1129 if (empty($this->loghandlers[$handler])) {
1130 $this->loghandlers[$handler] = $loghandlerinstance;
1137 if (!empty($this->file->mailing_limit_sendbyweb)) {
1138 $this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
1140 if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) {
1141 $this->global->MAILING_LIMIT_SENDBYWEB = 25;
1143 if (!empty($this->file->mailing_limit_sendbycli)) {
1144 $this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
1146 if (!empty($this->file->mailing_limit_sendbyday)) {
1147 $this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday;