BUGFIX Fixed Money->Nice() to provide symbol and currency shortname based on Money->getCurrency()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77754 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-05-25 06:03:06 +00:00
parent e1f54bc394
commit 4d55f1e5d7
2 changed files with 3 additions and 2 deletions

View File

@ -131,6 +131,9 @@ class Money extends DBField implements CompositeDBField {
*/
function Nice($options = array()) {
$amount = $this->getAmount();
if(!isset($options['display'])) $options['display'] = Zend_Currency::USE_SYMBOL;
if(!isset($options['currency'])) $options['currency'] = $this->getCurrency();
if(!isset($options['symbol'])) $options['symbol'] = $this->currencyLib->getSymbol($this->getCurrency(), $this->getLocale());
return (is_numeric($amount)) ? $this->currencyLib->toCurrency($amount, $options) : '';
}

View File

@ -117,7 +117,6 @@ class MoneyTest extends SapphireTest {
}
*/
/*
$INR = new Money();
$INR->setLocale('de_AT');
$INR->setCurrency('INR');
@ -129,7 +128,6 @@ class MoneyTest extends SapphireTest {
$this->assertSame('Rs. 0,00', $INR->Nice());
$INR->setAmount(-3);
$this->assertSame('-Rs. 3,00', $INR->Nice());
*/
}
public function testGetSign() {