Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 06:05:35 +02:00
parent 01dfbac1a1
commit 3eba955992
5 changed files with 19 additions and 19 deletions

View File

@ -42,7 +42,7 @@ dol_htmloutput_errors($object->error, $object->errors);
<input type="hidden" name="action" value="update">
<input type="hidden" name="id" value="<?php echo $object->id; ?>">
<input type="hidden" name="canvas" value="<?php echo $object->canvas; ?>">
<?php if (empty($conf->stock->enabled)) { ?>
<?php if (!isModEnabled('stock')) { ?>
<input name="seuil_stock_alerte" type="hidden" value="0">
<?php } ?>
@ -69,7 +69,7 @@ dol_htmloutput_errors($object->error, $object->errors);
<td><?php echo $form->selectarray('statut_buy', $statutarray, $object->status_buy); ?></td>
</tr>
<?php if (!empty($conf->stock->enabled)) { ?>
<?php if (isModEnabled('stock')) { ?>
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
<input name="seuil_stock_alerte" size="4" value="<?php echo $object->seuil_stock_alerte; ?>">
</td></tr>

View File

@ -77,7 +77,7 @@ if (!empty($conf->bom->enabled)) {
// Load translation files required by the page
$langs->loadLangs(array('products', 'other'));
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
$langs->load("stocks");
}
if (isModEnabled('facture')) {
@ -1457,7 +1457,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
}
if ($type != 1 && !empty($conf->stock->enabled)) {
if ($type != 1 && isModEnabled('stock')) {
// Default warehouse
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
@ -2017,7 +2017,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Stock
if ($object->isProduct() && !empty($conf->stock->enabled)) {
if ($object->isProduct() && isModEnabled('stock')) {
// Default warehouse
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
@ -2515,7 +2515,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Default warehouse
if ($object->isProduct() && !empty($conf->stock->enabled)) {
if ($object->isProduct() && isModEnabled('stock')) {
$warehouse = new Entrepot($db);
$warehouse->fetch($object->fk_default_warehouse);

View File

@ -369,7 +369,7 @@ if ($id > 0 || !empty($ref)) {
// Min customer price
print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>';
// Stock
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
print '<td class="right">'.$langs->trans('Stock').'</td>';
}
// Qty in kit
@ -444,7 +444,7 @@ if ($id > 0 || !empty($ref)) {
print '</td>';
// Stock
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
print '<td class="right">'.$value['stock'].'</td>'; // Real stock
}
@ -493,7 +493,7 @@ if ($id > 0 || !empty($ref)) {
print '<td>&nbsp;</td>';
// Stock
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
print '<td></td>'; // Real stock
}
@ -549,7 +549,7 @@ if ($id > 0 || !empty($ref)) {
print '</td>';
// Stock
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
print '<td class="liste_total right">&nbsp;</td>';
}
@ -566,7 +566,7 @@ if ($id > 0 || !empty($ref)) {
print '</tr>'."\n";
} else {
$colspan = 10;
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
$colspan++;
}

View File

@ -234,10 +234,10 @@ $arrayfields = array(
'p.numbuyprice'=>array('label'=>"BuyingPriceNumShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
'p.pmp'=>array('label'=>"PMPValueShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44),
'p.cost_price'=>array('label'=>"CostPrice", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45),
'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>50),
'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51),
'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52),
'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53),
'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>50),
'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51),
'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52),
'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53),
'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(isModEnabled('productbatch')), 'position'=>60),
'p.fk_country'=>array('label'=>"Country", 'checked'=>0, 'position'=>100),
'p.fk_state'=>array('label'=>"State", 'checked'=>0, 'position'=>101),
@ -1360,7 +1360,7 @@ if ($resql) {
}
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
if ((!empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
if ($obj->fk_product_type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
$option = 'nobatch';
if (empty($arrayfields['stock_virtual']['checked'])) {

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
}
if (isModEnabled("propal")) {
@ -84,7 +84,7 @@ if (!empty($conf->loan->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
}
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
}
if (isModEnabled('tax')) {
@ -716,7 +716,7 @@ if (!$showdatefilter) {
$langs->loadLangs(array("suppliers", "bills", "orders", "proposals", "margins"));
if (!empty($conf->stock->enabled)) {
if (isModEnabled('stock')) {
$langs->load('stocks');
}