Bug [0000064] Credit This on an invoice should automatically allocate the credit...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 26 Sep 2008 22:08:35 +0000 (22:08 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 26 Sep 2008 22:08:35 +0000 (22:08 +0000)
CHANGELOG.txt
sales/customer_credit_invoice.php
sales/includes/db/sales_credit_db.inc

index 2c23a361cd345250b5838f586136c7b2b3375598..9054c33158ed233e2dc2e7e4efccd5c833f5b25e 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+26-Sep-2008 Joe Hunt
+# Bug [0000064] Credit This on an invoice should automatically allocate the credit to that invoice
+$ /sales/includes/db/sales_credit_db.inc
+
 26-Sep-2008 Janusz Dobrowolski
 # Bug [0000062] Delivery Modifitication - duplicated tax details.
 $ /sales/includes/db/sales_delivery_db.inc
index ca1db0bd210799716d1f993205418c85d495fea5..53da31218773c3f60029533c30fe30dcac6dcc78 100644 (file)
@@ -113,6 +113,7 @@ if (isset($_GET['InvoiceNumber']) && $_GET['InvoiceNumber'] > 0) {
     $ci = new Cart(10, $_GET['InvoiceNumber'], true);
 
     $ci->trans_type = 11;
+    //$ci->src_docs = array($_GET['InvoiceNumber'], $ci->trans_no);
     $ci->src_docs = $ci->trans_no;
     $ci->src_date = $ci->document_date;
     $ci->trans_no = 0;
index 40bea1914713bd2ad7ac108a1758849f5d629779..c49a07f40e34c04b16ec24ef7eaacf29c1997b2c 100644 (file)
@@ -6,8 +6,8 @@
 //
 function write_credit_note($credit_note, $write_off_acc)
 {
-       $credit_invoice = count($credit_note->src_docs) ? reset($credit_note->src_docs) : 0;
-
+       // Changed 2008-09-26 Joe Hunt -------
+       $credit_invoice = count(array_keys($credit_note->src_docs)) ? reset(array_keys($credit_note->src_docs)) : 0;
 
        $credit_date = $credit_note->document_date;
        $tax_group_id = $credit_note->tax_group_id;
@@ -87,6 +87,13 @@ function write_credit_note($credit_note, $write_off_acc)
                                update_debtor_trans_allocation(10, $credit_invoice, $allocate_amount);
                                update_debtor_trans_allocation(11, $credit_no, $allocate_amount); // ***
                                add_cust_allocation($allocate_amount, 11, $credit_no, 10, $credit_invoice);
+                               // Exchange Variations Joe Hunt 2008-09-20 ////////////////////////////////////////
+
+                               exchange_variation(11, $credit_no, 10, $credit_invoice, $credit_date,
+                                       $allocate_amount, payment_person_types::customer());
+
+                               ///////////////////////////////////////////////////////////////////////////
+
                        }
                }
        }