MINOR Code formatting fixes for CurrencyField

This commit is contained in:
Sean Harvey 2012-04-12 12:11:22 +12:00
parent fd3de5158d
commit 9cf1686786

View File

@ -37,15 +37,9 @@ class CurrencyField extends TextField {
* Create a new class for this field
*/
function performReadonlyTransformation() {
$field = new CurrencyField_Readonly($this->name, $this->title, $this->value);
$field -> addExtraClass($this->extraClass());
return $field;
/*
$this is-a object and cant be passed as_a string of the first parameter of formfield constructor.
return new CurrencyField_Readonly($this);
*/
}
function validate($validator) {
@ -71,9 +65,8 @@ class CurrencyField_Readonly extends ReadonlyField{
if($this->value){
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
}else {
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
} else {
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
}
$valforInput = $this->value ? Convert::raw2att($val) : "";
return "<span class=\"readonly ".$this->extraClass()."\" id=\"" . $this->id() . "\">$val</span><input type=\"hidden\" name=\"".$this->name."\" value=\"".$valforInput."\" />";
@ -104,9 +97,8 @@ class CurrencyField_Disabled extends CurrencyField{
if($this->value){
$val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
$val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2);
}else {
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
} else {
$val = '<i>'._t('CurrencyField.CURRENCYSYMBOL', '$').'0.00</i>';
}
$valforInput = $this->value ? Convert::raw2att($val) : "";
return "<input class=\"text\" type=\"text\" disabled=\"disabled\" name=\"".$this->name."\" value=\"".$valforInput."\" />";