Major currency conversion bug (old 0.x bug)
Posted: Thu Jun 11, 2009 3:28 am
This was a bug we fix back in 0.x and i see this is another one that still exists in 1.x
In the system/library/currency.php file you have:
Note that even if you have a $currency specified, the $value check only checks "this->code]['value']"
It needs to be something like this:
This prevents the $currency argument in the format function from working.
In the system/library/currency.php file you have:
Code: Select all
public function format($number, $currency = NULL, $value = NULL, $format = TRUE) {
if ($currency) {
$symbol_left = $this->currencies[$currency]['symbol_left'];
$symbol_right = $this->currencies[$currency]['symbol_right'];
$decimal_place = $this->currencies[$currency]['decimal_place'];
} else {
$symbol_left = $this->currencies[$this->code]['symbol_left'];
$symbol_right = $this->currencies[$this->code]['symbol_right'];
$decimal_place = $this->currencies[$this->code]['decimal_place'];
}
if ($value) {
$value = $value;
} else {
$value = $this->currencies[$this->code]['value'];
}
.............
It needs to be something like this:
Code: Select all
public function format($number, $currency = NULL, $value = NULL, $format = TRUE) {
if ($currency) {
$symbol_left = $this->currencies[$currency]['symbol_left'];
$symbol_right = $this->currencies[$currency]['symbol_right'];
$decimal_place = $this->currencies[$currency]['decimal_place'];
} else {
$symbol_left = $this->currencies[$this->code]['symbol_left'];
$symbol_right = $this->currencies[$this->code]['symbol_right'];
$decimal_place = $this->currencies[$this->code]['decimal_place'];
$currency = $this->code;
}
if ($value) {
$value = $value;
} else {
$value = $this->currencies[$currency]['value'];
}
.............