diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 92a0255d76d..0ad7f6d6eb6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2948,7 +2948,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; } } elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 6b66c8d68e7..c65013722d4 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -157,7 +157,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) $h++; } - if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { + if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { $langs->load("stocks"); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderDispatch"); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 0d2edb4805e..cb79e006ba7 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -115,7 +115,7 @@ function product_prepare_head($object) } if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { // If physical product we can stock (or service with option) - if (!empty($conf->stock->enabled) && $user->rights->stock->lire) { + if (isModEnabled('stock') && $user->rights->stock->lire) { $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; $head[$h][1] = $langs->trans("Stock"); $head[$h][2] = 'stock'; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 22668a16be4..a9a1869fb30 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -127,7 +127,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('facture') || isModEnabled('contrat') - || !empty($conf->ficheinter->enabled) || isModEnabled('agenda') || isModEnabled('deplacement') || !empty($conf->stock->enabled)) { + || !empty($conf->ficheinter->enabled) || isModEnabled('agenda') || isModEnabled('deplacement') || isModEnabled('stock')) { $nbElements = 0; // Enable caching of thirdrparty count Contacts $cachekey = 'count_elements_project_'.$project->id; @@ -135,7 +135,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (!is_null($dataretrieved)) { $nbElements = $dataretrieved; } else { - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); } if (isModEnabled("propal")) { @@ -189,7 +189,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (isModEnabled('project')) { $nbElements += $project->getElementCount('project_task', 'projet_task'); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $nbElements += $project->getElementCount('stock_mouvement', 'stock'); } if (!empty($conf->salaries->enabled)) { diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 8e3c4f7112c..ffc455ab5f1 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -276,7 +276,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''.$langs->trans("DateCreation").''; print ''.$langs->trans("DateDeliveryPlanned").''; print ''.$langs->trans("QtyPreparedOrShipped").''; - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''.$langs->trans("Warehouse").''; } /*TODO Add link to expeditiondet_batch @@ -385,7 +385,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''.$objp->qty_shipped.''; // Warehouse - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''; if ($objp->warehouse_id > 0) { $warehousestatic->fetch($objp->warehouse_id);