From 97f5a721ebf8dbaa2447844e10f43adfd175160a Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 5 Oct 2015 16:10:56 +0800 Subject: [PATCH] DataObjects/Core_curr_rate.php --- DataObjects/Core_curr_rate.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/DataObjects/Core_curr_rate.php b/DataObjects/Core_curr_rate.php index 98dfa054..82f34b22 100644 --- a/DataObjects/Core_curr_rate.php +++ b/DataObjects/Core_curr_rate.php @@ -157,11 +157,19 @@ class Pman_Core_DataObjects_Core_curr_rate extends DB_DataObject { - $fr = $this->rate($from, $when) + $fr = $this->rate($from, $when); + $tr = $this->rate($to, $when); + if ($fr === false) { + $fr = 1; + } + if ($tr === false) { + $tr = 1; + } + //echo '
';print_R($this->rates);
-        $base = (1.0 / $this->rates[$from]) * $val;
+        $base = (1.0 / $fr) * $val;
   
-        return $this->rates[$to] * $base;
+        return $tr * $base;
     
     }
     
-- 
2.39.2