BUGFIX: Fix Money::setValue() using old api

This commit is contained in:
Andrew O'Neil 2012-04-11 15:30:38 +12:00
parent bdb312c665
commit 75c5134bc9

View File

@ -102,7 +102,7 @@ class Money extends DBField implements CompositeDBField {
function setValue($value, $record = null, $markChanged = true) {
// @todo Allow resetting value to NULL through Money $value field
if ($value instanceof Money && $value->hasValue()) {
if ($value instanceof Money && $value->exists()) {
$this->setCurrency($value->getCurrency(), $markChanged);
$this->setAmount($value->getAmount(), $markChanged);
if($markChanged) $this->isChanged = true;