mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
e1f54bc394
commit
4d55f1e5d7
@ -131,6 +131,9 @@ class Money extends DBField implements CompositeDBField {
|
|||||||
*/
|
*/
|
||||||
function Nice($options = array()) {
|
function Nice($options = array()) {
|
||||||
$amount = $this->getAmount();
|
$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) : '';
|
return (is_numeric($amount)) ? $this->currencyLib->toCurrency($amount, $options) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,6 @@ class MoneyTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
$INR = new Money();
|
$INR = new Money();
|
||||||
$INR->setLocale('de_AT');
|
$INR->setLocale('de_AT');
|
||||||
$INR->setCurrency('INR');
|
$INR->setCurrency('INR');
|
||||||
@ -129,7 +128,6 @@ class MoneyTest extends SapphireTest {
|
|||||||
$this->assertSame('Rs. 0,00', $INR->Nice());
|
$this->assertSame('Rs. 0,00', $INR->Nice());
|
||||||
$INR->setAmount(-3);
|
$INR->setAmount(-3);
|
||||||
$this->assertSame('-Rs. 3,00', $INR->Nice());
|
$this->assertSame('-Rs. 3,00', $INR->Nice());
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSign() {
|
public function testGetSign() {
|
||||||
|
Loading…
Reference in New Issue
Block a user