diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 92a8b471e5f..6b8177e5ed4 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -110,10 +110,10 @@ class box_graph_product_distribution extends ModeleBoxes if (!isModEnabled('facture') || empty($user->rights->facture->lire)) { $showinvoicenb = 0; } - if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) { + if (isModEnabled('propal') || empty($user->rights->propale->lire)) { $showpropalnb = 0; } - if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) { + if (!isModEnabled('commande') || empty($user->rights->commande->lire)) { $showordernb = 0; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7f30878d566..9db0f8aed7e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3550,7 +3550,7 @@ abstract class CommonObject if (!empty($conf->global->$MODULE)) { $modsactivated = explode(',', $conf->global->$MODULE); foreach ($modsactivated as $mod) { - if ($conf->$mod->enabled) { + if (!isModEnabled($mod->enabled) { return 1; // update was disabled by specific setup } } @@ -4883,7 +4883,7 @@ abstract class CommonObject // Define usemargins $usemargins = 0; - if (!empty($conf->margin->enabled) && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) { + if (isModEnabled('margin') && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) { $usemargins = 1; } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index f15d9f4d732..d67bee7abac 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -164,7 +164,7 @@ class Utils } // Update cachenbofdoc - if (!empty($conf->ecm->enabled) && $choice == 'allfiles') { + if (isModEnabled('ecm') && $choice == 'allfiles') { require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; $ecmdirstatic = new EcmDirectory($this->db); $result = $ecmdirstatic->refreshcachenboffile(1); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index da6a6c5e1f8..faf37b62d21 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -60,9 +60,9 @@ function product_prepare_head($object) $h++; } - if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase + if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase if ((((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->fournisseur->lire) - || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) + || (isModEnabled('margin') && $user->rights->margin->liretous) ) { if ($usercancreadprice) { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 8d6a5fe0508..09b0a4818f5 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -211,7 +211,7 @@ class modProduct extends DolibarrModules if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; } - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { + if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); } if (isModEnabled('stock')) { @@ -625,7 +625,7 @@ class modProduct extends DolibarrModules )); } - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { + if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); } if (is_object($mysoc) && $usenpr) { @@ -718,7 +718,7 @@ class modProduct extends DolibarrModules 'p.desiredstock' => '' )); } - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { + if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { $import_sample = array_merge($import_sample, array('p.cost_price'=>'90')); } if (is_object($mysoc) && $usenpr) {