N°1202 - Fix History on Decimal. No diff when modify only trailing 0s.

This commit is contained in:
Eric
2018-10-30 09:13:52 +01:00
parent b61d1feec4
commit c892862822

View File

@@ -2736,13 +2736,17 @@ class AttributeDecimal extends AttributeDBField
return null;
}
return (string)$proposedValue;
return $this->ScalarToSQL($proposedValue);
}
public function ScalarToSQL($value)
{
assert(is_null($value) || preg_match('/'.$this->GetValidationPattern().'/', $value));
if (!is_null($value) && ($value !== ''))
{
$value = sprintf("%01.".$this->Get('decimals')."f", $value);
}
return $value; // null or string
}
}