MINOR Formatting in MoneyField, added @todo

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77791 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-05-26 01:08:47 +00:00
parent 2a58703ecf
commit afbac71d31

View File

@ -72,12 +72,20 @@ class MoneyField extends FormField {
$this->value = $val;
if(is_array($val)) {
$this->fieldCurrency->setValue($val['Currency']);
$this->fieldAmount->setValue($val['Amount']);
$currency = $val['Currency'];
$amount = $val['Amount'];
} elseif($val instanceof Money) {
$this->fieldCurrency->setValue($val->getCurrency());
$this->fieldAmount->setValue($val->getAmount());
$currency = $val->getCurrency();
$amount = $val->getAmount();
}
// @todo Format numbers according to current locale, incl.
// decimal and thousands signs, while respecting the stored
// precision in the database without truncating it during display
// and subsequent save operations
$this->fieldCurrency->setValue($currency);
$this->fieldAmount->setValue($amount);
}
function saveInto($dataObject) {
@ -129,7 +137,6 @@ class MoneyField extends FormField {
function setLocale($locale) {
$this->_locale = $locale;
$this->fieldAmount->setLocale($locale);
}
function getLocale() {