mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR If CurrencyField->setValue() passed a null or empty value, default to 0.00 so number_format() has no issues converting the number
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97566 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
173473b707
commit
a6f9a2539b
@ -12,7 +12,8 @@ class CurrencyField extends TextField {
|
|||||||
* allows the value to be set ( not including $ signs and number format...)
|
* allows the value to be set ( not including $ signs and number format...)
|
||||||
*/
|
*/
|
||||||
function setValue($val) {
|
function setValue($val) {
|
||||||
$this->value = '$' . number_format(ereg_replace('[^0-9.]',"",$val), 2);
|
$value = ($val) ? $val : 0.00;
|
||||||
|
$this->value = '$' . number_format(ereg_replace('[^0-9.]', '', $value), 2);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Overwrite the datavalue before saving to the db ;-)
|
* Overwrite the datavalue before saving to the db ;-)
|
||||||
|
Loading…
Reference in New Issue
Block a user