mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX #2954 - Fixed support for negative numbers in decimal fields
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65269 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d145c50cc2
commit
33219fcad2
@ -31,7 +31,7 @@ class Decimal extends DBField {
|
|||||||
function saveInto($dataObject) {
|
function saveInto($dataObject) {
|
||||||
$fieldName = $this->name;
|
$fieldName = $this->name;
|
||||||
if($fieldName) {
|
if($fieldName) {
|
||||||
$dataObject->$fieldName = (float)preg_replace('/[^0-9.]/', '', $this->value);
|
$dataObject->$fieldName = (float)preg_replace('/[^0-9.\-\+]/', '', $this->value);
|
||||||
} else {
|
} else {
|
||||||
user_error("DBField::saveInto() Called on a nameless '" . get_class($this) . "' object", E_USER_ERROR);
|
user_error("DBField::saveInto() Called on a nameless '" . get_class($this) . "' object", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user