Merged last changes from stable.
[fa-stable.git] / purchasing / includes / db / supp_payment_db.inc
index 50ecfe2d5ab1e345036ef6f874d2e089c314f568..99fe530cad6001999c24d949c3cd87650ccee07b 100644 (file)
@@ -140,7 +140,7 @@ function add_supp_payment($supplier_id, $date_, $bank_account,
 
        if ($supp_charge != 0)
        {
-               $charge_act = get_company_pref('bank_charge_act');
+               $charge_act = get_bank_charge_account($bank_account);
                $total += add_gl_trans_supplier($trans_type, $payment_id, $date_, $charge_act, 0, 0,
                        $supp_charge, $supplier_id, "", $rate);
        }
@@ -156,7 +156,7 @@ function add_supp_payment($supplier_id, $date_, $bank_account,
 
    /*now enter the bank_trans entry */
        add_bank_trans($trans_type, $payment_id, $bank_account, $ref,
-               $date_, -($amount + $charge), PT_SUPPLIER,
+               $date_, -($amount + $supp_charge), PT_SUPPLIER,
                $supplier_id, $bank_account_currency,
                "Could not add the supplier payment bank transaction");