From 91a20f39fef37d3b2c1eb4dcc47055720bb37872 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 19 Sep 2014 02:40:34 +0200 Subject: [PATCH] Rerun. We must also test for availability on document date. --- sales/sales_order_entry.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index a147ea7f..90e76839 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -509,8 +509,10 @@ function check_item_data() elseif ($is_inventory_item && $_SESSION['Items']->trans_type!=ST_SALESORDER && $_SESSION['Items']->trans_type!=ST_SALESQUOTE && !$SysPrefs->allow_negative_stock()) { - $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], null); // Of course we must always test for stock availability by todays date. - if (input_num('qty') > $qoh) + $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], $_POST['OrderDate']); + $qoh_today = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], null); // Of course we must also test for stock availability by todays date. + $qty = input_num('qty'); + if ($qty > $qoh || $qty > $qoh_today) { $stock = get_item($_POST['stock_id']); display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:") . -- 2.30.2