From 33219fcad2a53e78e503f1669fb59515fecc3386 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 5 Nov 2008 04:10:48 +0000 Subject: [PATCH] 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 --- core/model/fieldtypes/Decimal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/model/fieldtypes/Decimal.php b/core/model/fieldtypes/Decimal.php index 140dd5bcb..5b4b1630e 100644 --- a/core/model/fieldtypes/Decimal.php +++ b/core/model/fieldtypes/Decimal.php @@ -31,7 +31,7 @@ class Decimal extends DBField { function saveInto($dataObject) { $fieldName = $this->name; if($fieldName) { - $dataObject->$fieldName = (float)preg_replace('/[^0-9.]/', '', $this->value); + $dataObject->$fieldName = (float)preg_replace('/[^0-9.\-\+]/', '', $this->value); } else { user_error("DBField::saveInto() Called on a nameless '" . get_class($this) . "' object", E_USER_ERROR); }