qoh checks only with allow_negative_stock off
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 30 Mar 2009 10:22:58 +0000 (10:22 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 30 Mar 2009 10:22:58 +0000 (10:22 +0000)
sales/includes/ui/sales_order_ui.inc

index 8006018a92c78120deb5f73108ca0aef42c0017f..af71bed18d8ca30b52411f5f6d8fc28a24423205 100644 (file)
@@ -164,19 +164,19 @@ function display_order_summary($title, &$order, $editable_items=false)
                $qoh_msg = '';
                if (!$editable_items || $id != $line_no)
                {
-                       if (is_inventory_item($stock_item->stock_id)) {
+                       if (!sys_prefs::allow_negative_stock() && is_inventory_item($stock_item->stock_id)) {
                                $qoh = get_qoh_on_date($stock_item->stock_id, 
                                        $_POST['Location'], $_POST['OrderDate']);
-                        if ($stock_item->qty_dispatched > $qoh) 
-                        {
-                               // oops, we don't have enough of one of the component items
-                               start_row("class='stockmankobg'");
-                               $qoh_msg .= $stock_item->stock_id . " - " . $stock_item->item_description . ": " .
-                               _("Quantity On Hand") . " = " 
-                               . number_format2($qoh, get_qty_dec($stock_item->stock_id)) . '<br>';
-                               $has_marked = true;
-                        } else 
-                               alt_table_row_color($k);
+                               if ($stock_item->qty_dispatched > $qoh) 
+                               {
+                                       // oops, we don't have enough of one of the component items
+                                       start_row("class='stockmankobg'");
+                                       $qoh_msg .= $stock_item->stock_id . " - " . $stock_item->item_description . ": " .
+                                       _("Quantity On Hand") . " = " 
+                                       . number_format2($qoh, get_qty_dec($stock_item->stock_id)) . '<br>';
+                                       $has_marked = true;
+                                } else 
+                                       alt_table_row_color($k);
                        } else {
                                alt_table_row_color($k);
                        }