diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8505af85ce5..dcf43bcf0cb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3245,7 +3245,7 @@ class Facture extends CommonInvoice $sortorder = 'ASC,ASC,ASC,ASC'; } - $resBatchList = $productbatch->findAllForProduct($productStatic->id, $idwarehouse, (!empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER) ? null : 0), $sortfield, $sortorder); + $resBatchList = $productbatch->findAllForProduct($productStatic->id, $idwarehouse, (getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER') ? null : 0), $sortfield, $sortorder); if (!is_array($resBatchList)) { $error++; $this->error = $this->db->lasterror(); @@ -3288,7 +3288,7 @@ class Facture extends CommonInvoice } if (!$error && $product_qty_remain > 0) { - if ($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER) { + if (getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER')) { // take in the first batch $batch = $batchList[0]; $result = $mouvP->livraison($user, $productStatic->id, $idwarehouse, $product_qty_remain, $this->lines[$i]->subprice, $langs->trans('InvoiceValidatedInDolibarr', $num), '', '', '', $batch->batch); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index a9fcea34440..97e846f3054 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1268,7 +1268,7 @@ if ($action == 'create') { print ''; $stockMin = false; - if (empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { + if (!getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER')) { $stockMin = 0; } print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1, 0, array(), 'minwidth200', '', 1, $stockMin, 'stock DESC, e.ref'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2392962a500..6c491bfc6e0 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -391,7 +391,7 @@ class MouvementStock extends CommonObject // Check if stock is enough when qty is < 0 // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. - if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { + if ($movestock && $qty < 0 && !getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER')) { if (isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { $foundforbatch = 0; $qtyisnotenough = 0;