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; $this->value = $val;
if(is_array($val)) { if(is_array($val)) {
$this->fieldCurrency->setValue($val['Currency']); $currency = $val['Currency'];
$this->fieldAmount->setValue($val['Amount']); $amount = $val['Amount'];
} elseif($val instanceof Money) { } elseif($val instanceof Money) {
$this->fieldCurrency->setValue($val->getCurrency()); $currency = $val->getCurrency();
$this->fieldAmount->setValue($val->getAmount()); $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) { function saveInto($dataObject) {
@ -129,7 +137,6 @@ class MoneyField extends FormField {
function setLocale($locale) { function setLocale($locale) {
$this->_locale = $locale; $this->_locale = $locale;
$this->fieldAmount->setLocale($locale);
} }
function getLocale() { function getLocale() {