mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE: Added new config option Money.default_currency.
This commit is contained in:
parent
7036abbd75
commit
7201f06476
@ -106,9 +106,11 @@ class Money extends DBField implements CompositeDBField {
|
|||||||
$this->setCurrency($value->getCurrency(), $markChanged);
|
$this->setCurrency($value->getCurrency(), $markChanged);
|
||||||
$this->setAmount($value->getAmount(), $markChanged);
|
$this->setAmount($value->getAmount(), $markChanged);
|
||||||
if($markChanged) $this->isChanged = true;
|
if($markChanged) $this->isChanged = true;
|
||||||
} else if($record && isset($record[$this->name . 'Currency']) && isset($record[$this->name . 'Amount'])) {
|
} else if($record && isset($record[$this->name . 'Amount'])) {
|
||||||
if($record[$this->name . 'Currency'] && $record[$this->name . 'Amount']) {
|
if($record[$this->name . 'Amount']) {
|
||||||
$this->setCurrency($record[$this->name . 'Currency'], $markChanged);
|
if(!empty($record[$this->name . 'Currency'])) $this->setCurrency($record[$this->name . 'Currency'], $markChanged);
|
||||||
|
else if($currency = (string)$this->config()->get('default_currency')) $this->setCurrency($currency, $markChanged);
|
||||||
|
|
||||||
$this->setAmount($record[$this->name . 'Amount'], $markChanged);
|
$this->setAmount($record[$this->name . 'Amount'], $markChanged);
|
||||||
} else {
|
} else {
|
||||||
$this->value = $this->nullValue();
|
$this->value = $this->nullValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user