Merged last changes from stable.
[fa-stable.git] / gl / includes / db / gl_db_banking.inc
index e6d65d92d79af69f56869e2b806c9b182de42700..964eac0ce384556adff2f08714e0ceea5eb6a1dd 100644 (file)
@@ -117,7 +117,6 @@ function get_account_home_balance($person_id, $person_type, $rec_account, $to_da
 }
 //------------- New helper functions for revaluation of customer/supplier currencies 2011-05-08 Joe Hunt.
 
-
 function add_exchange_variation_all($date=null, $ref="", $memo)
 {
        global $Refs;
@@ -179,7 +178,7 @@ function add_exchange_variation_all($date=null, $ref="", $memo)
                }
        }
        //------------- END
-               
+
        commit_transaction();
        return array(($exchanged ? $trans_no : 0), $je);
 }
@@ -235,7 +234,7 @@ function add_bank_transfer($from_account, $to_account, $date_,
        if ($charge != 0)
        {
                /* Now Debit bank charge account with charges */
-               $charge_act = get_company_pref('bank_charge_act');
+               $charge_act = get_bank_charge_account($from_account);
                $total += add_gl_trans($trans_type, $trans_no, $date_,
                        $charge_act, 0, 0, $person_id, $charge, $currency);
        }
@@ -262,7 +261,6 @@ function add_bank_transfer($from_account, $to_account, $date_,
        if ($SysPrefs->auto_currency_revaluation())
        {
                $currency = get_bank_account_currency($to_account);
-       
                if (add_exchange_variation($trans_no1, $date_, $to_account, $to_gl_account,     
                        $currency, PT_MISC, $person_id))
                        $exchanged = true;
@@ -317,6 +315,7 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
                'person_type_id', 'person_id', 'person_detail_id', 'ref', 'memo_', 'use_transaction', 'settled_amount'),
                $args);
        hook_db_prewrite($args, $trans_type);
+
        $aid = 0;
        if ($trans_no) {
                $old_trans = $trans_no;
@@ -451,5 +450,3 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
 
        return array($trans_type, $trans_no);
 }
-
-?>
\ No newline at end of file