BUGFIX: pass-in the params in right order when constructing of Zend_Currency in Money Constructor. Add NiceWithShortname function.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76299 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-05-06 23:32:57 +00:00
parent b20b6e0f95
commit b50d564a5c

View File

@ -65,7 +65,7 @@ class Money extends DBField implements CompositeDBField {
);
function __construct($name = null) {
$this->currencyLib = new Zend_Currency(i18n::default_locale());
$this->currencyLib = new Zend_Currency(null, i18n::default_locale());
parent::__construct($name);
}
@ -117,6 +117,15 @@ class Money extends DBField implements CompositeDBField {
function Nice($options = array()) {
return $this->currencyLib->toCurrency($this->getAmount(), $options);
}
/**
* @return string
*/
function NiceWithShortname($options = array()){
$shortName = $this->getShortName();
$symbol = $this->getSymbol();
return $shortName."(".$symbol.")"." ".$this->getAmount();
}
/**
* @return string