Merged changes up to version 2.3.4 into unstable.
[fa-stable.git] / includes / ui / items_cart.inc
index b0d3a609cd30d5c9a9a53d5b63d6e04bf4fb6bf4..a5e15fdbf4a524d1c7ded60d06f48ed4b6a75372 100644 (file)
@@ -20,8 +20,6 @@ class items_cart
 
        var     $order_id;
 
-       var $editing_item, $deleting_item;
-
        var $from_loc;
        var $to_loc;
        var $tran_date;
@@ -31,6 +29,7 @@ class items_cart
        var $person_id;
        var $branch_id;
        var $reference;
+       var $original_amount;
        
        function items_cart($type)
        {
@@ -52,7 +51,7 @@ class items_cart
                else
                {
                        // shouldn't come here under normal circumstances
-                       display_db_error("unexpected - adding an invalid item or null quantity", "", true);
+                       display_error("unexpected - adding an invalid item or null quantity", "", true);
                }
 
                return false;
@@ -107,19 +106,22 @@ class items_cart
                else
                {
                        // shouldn't come here under normal circumstances
-                       display_db_error("unexpected - invalid parameters in add_gl_item($code_id, $dimension_id, $dimension2_id, $amount,...)", "", true);
+                       display_error("unexpected - invalid parameters in add_gl_item($code_id, $dimension_id, $dimension2_id, $amount,...)", "", true);
                }
 
                return false;
        }
 
-       function update_gl_item($index, $dimension_id, $dimension2_id, $amount, $reference, $description=null)
+       function update_gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null)
        {
+           $this->gl_items[$index]->code_id = $code_id;
                $this->gl_items[$index]->dimension_id = $dimension_id;
                $this->gl_items[$index]->dimension2_id = $dimension2_id;
                $this->gl_items[$index]->amount = $amount;
                $this->gl_items[$index]->reference = $reference;
-               if ($description != null)
+               if ($description == null)
+                       $this->gl_items[$index]->description = get_gl_account_name($code_id);
+               else
                        $this->gl_items[$index]->description = $description;
 
        }
@@ -195,7 +197,7 @@ class line_item
                $item_row = get_item($stock_id);
 
                if ($item_row == null)
-                       display_db_error("invalid item added to order : $stock_id", "");
+                       display_error("invalid item added to order : $stock_id", "");
 
                $this->mb_flag = $item_row["mb_flag"];
                $this->units = $item_row["units"];
@@ -218,7 +220,9 @@ class line_item
 
        function check_qoh($location, $date_, $reverse)
        {
-       if (!sys_prefs::allow_negative_stock())
+               global $SysPrefs;
+               
+       if (!$SysPrefs->allow_negative_stock())
        {
                        if (has_stock_holding($this->mb_flag))
                        {