mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Money->setValue() was not working when loading $value and $record parameters, and only $record had a
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77790 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d8b46e5501
commit
2a58703ecf
@ -101,7 +101,8 @@ class Money extends DBField implements CompositeDBField {
|
||||
}
|
||||
|
||||
function setValue($value,$record=null) {
|
||||
if ($value instanceof Money) {
|
||||
// @todo Allow resetting value to NULL through Money $value field
|
||||
if ($value instanceof Money && $value->hasValue()) {
|
||||
$this->setCurrency($value->getCurrency());
|
||||
$this->setAmount($value->getAmount());
|
||||
} else if($record && isset($record[$this->name . 'Currency']) && isset($record[$this->name . 'Amount'])) {
|
||||
@ -268,6 +269,7 @@ class Money extends DBField implements CompositeDBField {
|
||||
public function scaffoldFormField($title = null) {
|
||||
$field = new MoneyField($this->name);
|
||||
$field->setAllowedCurrencies($this->getAllowedCurrencies());
|
||||
$field->setLocale($this->getLocale());
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user