Fixed problem with customer payment allocations (invalid exrate stored in debtor_tran...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 25 Aug 2013 18:39:41 +0000 (20:39 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 25 Aug 2013 18:39:41 +0000 (20:39 +0200)
sales/includes/db/payment_db.inc

index 9e0e4b16e6aacc34d593fff1edf85c837eba1198..e7c5729aab921b3d664f30fee0656e2f42caa678 100644 (file)
@@ -42,11 +42,10 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou
 
        $bank = get_bank_account($bank_account);
        if (!$rate)
-               $rate = get_exchange_rate_from_to(get_customer_currency($customer_id),
-                       $bank['bank_curr_code'], $date_ );
+               $rate = get_exchange_rate_from_home_currency($bank['bank_curr_code'], $date_ );
+
        if (!$bank_amount)      // backward compatibility workaround
        {
-
                $bank_amount = $amount/$rate;
        }