public $__table = 'core_curr_rate'; // table name
public $id;
public $curr;
- public $rate;
+ public $rate; // always to USD...
public $from_dt;
public $to_dt;
}
- function convertCurrency($val, $from, $to)
+ function rate($cur, $when)
{
- $r = $this->loadRates();
+ $this->loadRates(); // check if we have an rates.
+
+ $r = DB_DataObject::factory('core_curr_rate');
+ $r->curr = $cur;
+ $r->whereAdd('from_dt < when_dt
+
+ }
+
+ function convert($val, $from, $to, $when = false)
+ {
+
+
+
if ($r === false) {
return false;
}