[0000936] Fixed invalid sales order update on voiding delivery note after SO line...
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Wed, 20 Jul 2011 14:09:16 +0000 (16:09 +0200)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Wed, 20 Jul 2011 14:09:16 +0000 (16:09 +0200)
sales/includes/db/sales_delivery_db.inc

index b234e424fa73e65ed6e4aebd60edb1407e3b4a96..72392077b4e619f0a2f4e2ab7b84626dfdf1b7ce 100644 (file)
@@ -166,10 +166,8 @@ function void_sales_delivery($type, $type_no, $transactions=true)
 
        if ($order) {
                $auto = (get_reference(ST_SALESORDER, $order) == "auto");
 
        if ($order) {
                $auto = (get_reference(ST_SALESORDER, $order) == "auto");
-               $order_items = get_sales_order_details($order, ST_SALESORDER);
                while ($row = db_fetch($items_result)) {
                while ($row = db_fetch($items_result)) {
-                       $order_line = db_fetch($order_items);
-                       update_parent_line(ST_CUSTDELIVERY, $order_line['id'], -$row['quantity'], $auto);
+                       update_parent_line(ST_CUSTDELIVERY, $row['src_id'], -$row['quantity'], $auto);
                }
        }
 
                }
        }