From 272e3d19e87eee8ded53875760a2e061ee3840c9 Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Fri, 13 Oct 2023 16:35:52 +0200 Subject: [PATCH] CORE expedition: Fix creation d'expedition lorsque que l'on as des entrepot sans stocks mais que l'on authorise les mouvements de stock negatif --- htdocs/expedition/card.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6c455b07a947d..8479df649c2f6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1492,7 +1492,7 @@ // Define nb of lines suggested for this order line $nbofsuggested = 0; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { - if ($stock_warehouse->real > 0) { + if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { $nbofsuggested++; } } @@ -1505,7 +1505,7 @@ } $tmpwarehouseObject->fetch($warehouse_id); - if ($stock_warehouse->real > 0) { + if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { $stock = +$stock_warehouse->real; // Convert it to number $deliverableQty = min($quantityToBeDelivered, $stock); $deliverableQty = max(0, $deliverableQty); @@ -1824,7 +1824,7 @@ $nbofsuggested = 0; $batchlist = array(); foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { - if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { + if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) { $nbofsuggested+=count($stock_warehouse->detail_batch); } if (!empty($stock_warehouse->detail_batch)) { @@ -1853,7 +1853,7 @@ continue; } $tmpwarehouseObject->fetch($warehouse_id); - if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { + if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) { $batchStock = +$dbatch->qty; // To get a numeric if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) { $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]); @@ -1939,6 +1939,9 @@ $disabled = 'disabled="disabled"'; } print ' '; + if (empty($disabled) && !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { + print ''; + } } else { print $langs->trans("NA"); }