From ee65f40512cb009072156e7e19f19f42c59bfb2f Mon Sep 17 00:00:00 2001 From: moreauftheobald Date: Fri, 15 Nov 2024 23:00:56 +0100 Subject: [PATCH] Tracking $conf->module->enabled part 2 (#31899) Co-authored-by: Theobald --- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/core/bookmarks_page.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/contact.lib.php | 2 +- htdocs/core/lib/member.lib.php | 4 ++-- htdocs/core/lib/usergroups.lib.php | 4 ++-- htdocs/core/login/functions_ldap.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ce3c6f96804..c42b5b22c93 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -402,8 +402,8 @@ class Propal extends CommonObject 'fk_delivery_address' => array('type' => 'integer', 'label' => 'DeliveryAddress', 'enabled' => 1, 'visible' => 0, 'position' => 200), // deprecated 'fk_input_reason' => array('type' => 'integer', 'label' => 'InputReason', 'enabled' => 1, 'visible' => -1, 'position' => 205), 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 215), - 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 220), - 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 225), + 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 220), + 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 225), 'fk_multicurrency' => array('type' => 'integer', 'label' => 'MulticurrencyID', 'enabled' => 1, 'visible' => -1, 'position' => 230), 'multicurrency_code' => array('type' => 'varchar(255)', 'label' => 'MulticurrencyCurrency', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 235), 'multicurrency_tx' => array('type' => 'double(24,8)', 'label' => 'MulticurrencyRate', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 240, 'isameasure' => 1), diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php index e59b2ef2edb..e3fcdbc8545 100644 --- a/htdocs/core/bookmarks_page.php +++ b/htdocs/core/bookmarks_page.php @@ -97,7 +97,7 @@ $bookmarkList = ''; $searchForm = ''; -if (empty($conf->bookmark->enabled)) { +if (!isModEnabled('bookmark')) { $langs->load("admin"); $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).''; $bookmarkList .= '

'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0e6cbe8d9d..a5aae13bf76 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,7 +507,7 @@ class FormFile $printer = 0; // The direct print feature is implemented only for such elements if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) { - $printer = ($user->hasRight('printing', 'read') && !empty($conf->printing->enabled)); + $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); } $hookmanager->initHooks(array('formfile')); diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 747a5600735..24bb66763a5 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -43,7 +43,7 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'card'; $tab++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_CONTACT_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_CONTACT_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index ce5294d3ff9..3826c28e7e3 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -43,7 +43,7 @@ function member_prepare_head(Adherent $object) $head[$h][2] = 'general'; $h++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_MEMBER_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_MEMBER_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); @@ -193,7 +193,7 @@ function member_type_prepare_head(AdherentType $object) $h++; } - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index ba1064ec249..1604ee7cc70 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -53,7 +53,7 @@ function user_prepare_head(User $object) $head[$h][2] = 'user'; $h++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id; @@ -254,7 +254,7 @@ function group_prepare_head($object) $head[$h][2] = 'group'; $h++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 0e190d1a31e..8864a4dc0bf 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -167,7 +167,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // Note: Test on date validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method // ldap2dolibarr synchronisation - if ($login && !empty($conf->ldap->enabled) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization + if ($login && isModEnabled('ldap') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization dol_syslog("functions_ldap::check_user_password_ldap Sync ldap2dolibarr"); // On charge les attributes du user ldap