From 9a16b076ac13778536262a3d1613072e1f2d6cae Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 17 May 2011 23:22:45 +0200 Subject: [PATCH] Correction in inventory_?db.inc. Chaitanya. --- includes/db/inventory_db.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/db/inventory_db.inc b/includes/db/inventory_db.inc index af2898f..1f1c3c3 100644 --- a/includes/db/inventory_db.inc +++ b/includes/db/inventory_db.inc @@ -129,7 +129,7 @@ function last_negative_stock_trans_id($stock_id, $to) $qty = 0; $flag = 0; - $negative_trans_id = 1; + $negative_trans_id = -1; while ($myrow = db_fetch($result)) { @@ -143,7 +143,10 @@ function last_negative_stock_trans_id($stock_id, $to) $flag = 0; } - return $negative_trans_id; + if ($flag == 1) + return $negative_trans_id; + else + return false; } //------------------------------------------------------------------- @@ -208,7 +211,7 @@ function adjust_deliveries($stock_id, $material_cost, $to) return; $from = last_negative_stock_trans_id($stock_id, $to); - if ($from == false || $from == "") + if ($from == false || $from == -1) return; $row = get_deliveries_from_trans($stock_id, $from); -- 2.30.2