Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: negative values in read only currency field
Don’t strip out ‘-‘ character as this makes negative values appear to be positive (Fixes #8126)
  • Loading branch information
jonom committed Jun 1, 2018
1 parent 624a532 commit 5a5ba1e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Forms/CurrencyField_Disabled.php
Expand Up @@ -22,7 +22,7 @@ public function Field($properties = array())
{
if ($this->value) {
$val = Convert::raw2xml($this->value);
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/', "", $val), 2);
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.-]/', "", $val), 2);
$valforInput = Convert::raw2att($val);
} else {
$valforInput = '';
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/CurrencyField_Readonly.php
Expand Up @@ -20,7 +20,7 @@ public function Field($properties = array())
{
if ($this->value) {
$val = Convert::raw2xml($this->value);
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/', "", $val), 2);
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.-]/', "", $val), 2);
$valforInput = Convert::raw2att($val);
} else {
$val = '<i>' . _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . '0.00</i>';
Expand Down

0 comments on commit 5a5ba1e

Please sign in to comment.