Index: branches/5.3.x/units/helpers/currency_rates.php =================================================================== diff -u -r15492 -r15695 --- branches/5.3.x/units/helpers/currency_rates.php (.../currency_rates.php) (revision 15492) +++ branches/5.3.x/units/helpers/currency_rates.php (.../currency_rates.php) (revision 15695) @@ -1,6 +1,6 @@ Application->getCache($cache_key); $primary = $this->Application->GetPrimaryCurrency(); - if ($rates === false) { + if ( $rates === false ) { $this->Conn->nextQueryCachable = true; $sql = 'SELECT ISO, RateToPrimary - FROM ' . $this->Application->getUnitOption('curr', 'TableName') . ' + FROM ' . $this->Application->getUnitConfig('curr')->getTableName() . ' WHERE Status = ' . STATUS_ACTIVE; $rates = $this->Conn->Query($sql); @@ -55,24 +55,23 @@ { $source_cur = ($source_cur == 'PRIMARY') ? $this->Application->GetPrimaryCurrency() : $source_cur; $target_cur = ($target_cur == 'PRIMARY') ? $this->Application->GetPrimaryCurrency() : $target_cur; - if($source_cur == $target_cur) - { + + if ( $source_cur == $target_cur ) { return 1; } - if($this->ExchangeRates[$target_cur]['TARGET'] == $source_cur) - { - $rate = ($this->ExchangeRates[$target_cur]['RATE'] == 0) ? false : 1 / $this->ExchangeRates[$target_cur]['RATE']; + if ( $this->ExchangeRates[$target_cur]['TARGET'] == $source_cur ) { + $rate = ($this->ExchangeRates[$target_cur]['RATE'] == 0) ? false : 1 / $this->ExchangeRates[$target_cur]['RATE']; } - elseif($this->ExchangeRates[$source_cur]['TARGET'] == $target_cur) - { + elseif ( $this->ExchangeRates[$source_cur]['TARGET'] == $target_cur ) { $rate = $this->ExchangeRates[$source_cur]['RATE']; } - else - { + else { $rate = ($this->ExchangeRates[$target_cur]['RATE'] == 0) ? false : $this->ExchangeRates[$source_cur]['RATE'] / $this->ExchangeRates[$target_cur]['RATE']; } + $rate *= $units; + return $rate; } @@ -93,7 +92,7 @@ $symbol_sql = 'IF(COALESCE(Symbol, "") = "", CONCAT(ISO, " "), Symbol)'; $sql = 'SELECT IF(SymbolPosition = 0, CONCAT(' . $symbol_sql . ', "%s"), CONCAT("%s", ' . $symbol_sql . ')), LOWER(ISO) AS ISO - FROM ' . $this->Application->getUnitOption('curr', 'TableName') . ' + FROM ' . $this->Application->getUnitConfig('curr')->getTableName() . ' WHERE Status = ' . STATUS_ACTIVE; $iso_masks = $this->Conn->GetCol($sql, 'ISO'); $this->Application->setCache($cache_key, $iso_masks);