- }
- $failed_item = $_SESSION['adj_items']->check_qoh($_POST['StockLocation'], $_POST['AdjDate'], !$_POST['Increase']);
- if ($failed_item != null)
- {
- display_error(_("The adjustment cannot be processed because an adjustment item would cause a negative inventory balance :") .
- " " . $failed_item->stock_id . " - " . $failed_item->item_description);
+ } else {
+ $failed_item = $adj->check_qoh($_POST['StockLocation'], $_POST['AdjDate'], !$_POST['Increase']);
+ if ($failed_item >= 0)
+ {
+ $line = $adj->line_items[$failed_item];
+ display_error(_("The adjustment cannot be processed because an adjustment item would cause a negative inventory balance :") .
+ " " . $line->stock_id . " - " . $line->item_description);
+ $_POST['Edit'.$failed_item] = 1; // enter edit mode
+ unset($_POST['Process']);