Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 22:46:35 +02:00
parent ef94f2af70
commit 70e313f16e
5 changed files with 10 additions and 10 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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) {