X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=inventory%2Ftransfers.php;h=0da6d7559f6da5f200e46b46b2bd27489411caf1;hb=fbf51ab0febfd0885620abcab8738339d156ff45;hp=874d7bff79b344e9a8e61e67d6fd3dc8b7274f36;hpb=d2413b54b1621203e9a47fbde443e854f76a2bbf;p=fa-stable.git diff --git a/inventory/transfers.php b/inventory/transfers.php index 874d7bff..0da6d755 100644 --- a/inventory/transfers.php +++ b/inventory/transfers.php @@ -76,7 +76,6 @@ function handle_new_order() if (isset($_POST['Process'])) { - global $Refs; $tr = &$_SESSION['transfer_items']; $input_error = 0; @@ -84,7 +83,7 @@ if (isset($_POST['Process'])) if (count($tr->line_items) == 0) { display_error(_("You must enter at least one non empty item line.")); set_focus('stock_id'); - return false; + $input_error = 1; } if (!$Refs->is_valid($_POST['ref'])) { @@ -115,17 +114,14 @@ if (isset($_POST['Process'])) display_error(_("The locations to transfer from and to must be different.")); set_focus('FromStockLocation'); $input_error = 1; - } - else + } + elseif (!$SysPrefs->allow_negative_stock()) { - $failed_item = $tr->check_qoh($_POST['FromStockLocation'], $_POST['AdjDate'], true); - if ($failed_item >= 0) + $low_stock = $tr->check_qoh($_POST['FromStockLocation'], $_POST['AdjDate'], true); + + if ($low_stock) { - $line = $tr->line_items[$failed_item]; - display_error(_("The quantity entered is greater than the available quantity for this item at the source location :") . - " " . $line->stock_id . " - " . $line->item_description); - echo "
"; - $_POST['Edit'.$failed_item] = 1; // enter edit mode + display_error(_("The transfer cannot be processed because it would cause negative inventory balance in source location for marked items as of document date or later.")); $input_error = 1; } }