mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8127 from jonom/4.0-read-only-currency
Fix: negative values in read only currency field
This commit is contained in:
commit
1658fe7617
@ -22,7 +22,7 @@ class CurrencyField_Disabled extends CurrencyField
|
||||
{
|
||||
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 = '';
|
||||
|
@ -20,7 +20,7 @@ class CurrencyField_Readonly extends ReadonlyField
|
||||
{
|
||||
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>';
|
||||
|
Loading…
Reference in New Issue
Block a user