Fixed Delivery note bug : Parent constraints not working if sales order line deleted...
authorJoe <unknown>
Sat, 24 Jan 2015 09:25:32 +0000 (10:25 +0100)
committerJoe <unknown>
Sat, 24 Jan 2015 09:25:32 +0000 (10:25 +0100)
sales/includes/cart_class.inc

index a363562eeb4f39ab5101b977a8944e62ac9056a9..8a4e11e6eb6d56ed1473e45ac02bbba57d294f27 100644 (file)
@@ -168,6 +168,11 @@ class cart
                while (($line_no < count($this->line_items)) && ($srcline = db_fetch($srcdetails))) {
                        $line = &$this->line_items[$line_no];
                        $src_docs[] = $src_type == ST_SALESORDER ?  $srcline['order_no'] : $srcline['debtor_trans_no'];
+                       while($srcline['id'] != $line->src_id) // Logic : This will increment the line_items array till sales_order line is matched.
+                       {       // 0002259: Fixes Delivery note bug : Parent constraints not working if sales order line deleted after delivery 
+                       $line_no++;
+                       $line = &$this->line_items[$line_no];
+                       }
                        if ($srcline['id'] == $line->src_id) {
                                if ($this->trans_type == ST_SALESINVOICE)
                                        $line->src_no = $srcline['debtor_trans_no'];