From 22c7c058928721c3feb6602dddaacbb116a84334 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 26 Sep 2008 22:08:35 +0000 Subject: [PATCH] Bug [0000064] Credit This on an invoice should automatically allocate the credit to that invoice --- CHANGELOG.txt | 4 ++++ sales/customer_credit_invoice.php | 1 + sales/includes/db/sales_credit_db.inc | 11 +++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2c23a361..9054c331 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/sales/customer_credit_invoice.php b/sales/customer_credit_invoice.php index ca1db0bd..53da3121 100644 --- a/sales/customer_credit_invoice.php +++ b/sales/customer_credit_invoice.php @@ -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; diff --git a/sales/includes/db/sales_credit_db.inc b/sales/includes/db/sales_credit_db.inc index 40bea191..c49a07f4 100644 --- a/sales/includes/db/sales_credit_db.inc +++ b/sales/includes/db/sales_credit_db.inc @@ -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()); + + /////////////////////////////////////////////////////////////////////////// + } } } -- 2.30.2