diff --git a/htdocs/product/canvas/product/tpl/card_edit.tpl.php b/htdocs/product/canvas/product/tpl/card_edit.tpl.php index b21355c1c21..be4d4099d9b 100644 --- a/htdocs/product/canvas/product/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_edit.tpl.php @@ -42,7 +42,7 @@ dol_htmloutput_errors($object->error, $object->errors); -stock->enabled)) { ?> + @@ -69,7 +69,7 @@ dol_htmloutput_errors($object->error, $object->errors); selectarray('statut_buy', $statutarray, $object->status_buy); ?> -stock->enabled)) { ?> + trans("StockLimit"); ?> diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5d1613b05f2..c856ef97a35 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -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 ''; } - if ($type != 1 && !empty($conf->stock->enabled)) { + if ($type != 1 && isModEnabled('stock')) { // Default warehouse print ''.$langs->trans("DefaultWarehouse").''; 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 ''.$langs->trans("DefaultWarehouse").''; 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); diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index c10b5abe93e..3f3d23b764c 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -369,7 +369,7 @@ if ($id > 0 || !empty($ref)) { // Min customer price print ''.$langs->trans('MinCustomerPrice').''; // Stock - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''.$langs->trans('Stock').''; } // Qty in kit @@ -444,7 +444,7 @@ if ($id > 0 || !empty($ref)) { print ''; // Stock - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''.$value['stock'].''; // Real stock } @@ -493,7 +493,7 @@ if ($id > 0 || !empty($ref)) { print ' '; // Stock - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''; // Real stock } @@ -549,7 +549,7 @@ if ($id > 0 || !empty($ref)) { print ''; // Stock - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ' '; } @@ -566,7 +566,7 @@ if ($id > 0 || !empty($ref)) { print ''."\n"; } else { $colspan = 10; - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $colspan++; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7b6014c6bc1..0a17c8e936f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -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'])) { diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 8c7f2e0df51..bc29d2dca1e 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -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'); }