Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 06:02:37 +02:00
parent 5fc79979bc
commit d7d5199689
5 changed files with 8 additions and 8 deletions

View File

@ -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)) { if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1; $accessallowed = 1;
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file;
} }
} elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { } elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) {

View File

@ -157,7 +157,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object)
$h++; $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"); $langs->load("stocks");
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id;
$head[$h][1] = $langs->trans("OrderDispatch"); $head[$h][1] = $langs->trans("OrderDispatch");

View File

@ -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 ($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][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id;
$head[$h][1] = $langs->trans("Stock"); $head[$h][1] = $langs->trans("Stock");
$head[$h][2] = 'stock'; $head[$h][2] = 'stock';

View File

@ -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")) if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))
|| isModEnabled("propal") || isModEnabled('commande') || isModEnabled("propal") || isModEnabled('commande')
|| isModEnabled('facture') || isModEnabled('contrat') || 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; $nbElements = 0;
// Enable caching of thirdrparty count Contacts // Enable caching of thirdrparty count Contacts
$cachekey = 'count_elements_project_'.$project->id; $cachekey = 'count_elements_project_'.$project->id;
@ -135,7 +135,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (!is_null($dataretrieved)) { if (!is_null($dataretrieved)) {
$nbElements = $dataretrieved; $nbElements = $dataretrieved;
} else { } else {
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project');
} }
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
@ -189,7 +189,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (isModEnabled('project')) { if (isModEnabled('project')) {
$nbElements += $project->getElementCount('project_task', 'projet_task'); $nbElements += $project->getElementCount('project_task', 'projet_task');
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$nbElements += $project->getElementCount('stock_mouvement', 'stock'); $nbElements += $project->getElementCount('stock_mouvement', 'stock');
} }
if (!empty($conf->salaries->enabled)) { if (!empty($conf->salaries->enabled)) {

View File

@ -276,7 +276,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
print '<td class="center">'.$langs->trans("DateCreation").'</td>'; print '<td class="center">'.$langs->trans("DateCreation").'</td>';
print '<td class="center">'.$langs->trans("DateDeliveryPlanned").'</td>'; print '<td class="center">'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>'; print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td>'.$langs->trans("Warehouse").'</td>'; print '<td>'.$langs->trans("Warehouse").'</td>';
} }
/*TODO Add link to expeditiondet_batch /*TODO Add link to expeditiondet_batch
@ -385,7 +385,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
print '<td class="center">'.$objp->qty_shipped.'</td>'; print '<td class="center">'.$objp->qty_shipped.'</td>';
// Warehouse // Warehouse
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td>'; print '<td>';
if ($objp->warehouse_id > 0) { if ($objp->warehouse_id > 0) {
$warehousestatic->fetch($objp->warehouse_id); $warehousestatic->fetch($objp->warehouse_id);