28 lines
867 B
PHP

<?php
class attr_money extends attr {
function getDBType() {
return "decimal(14,4)";
}
function render_input() {
if ( $this->getAttrSetting('mand')) {
return '<input autocomplete="off" id="' . $this->attr_name . '" type="number" step="0.01" name="' . $this->attr_name . '" value="' .$this->getCurVal() . '" class="form-control" required="required">';
} else {
return '<input autocomplete="off" id="' . $this->attr_name . '" type="number" step="0.01" name="' . $this->attr_name . '" value="' .$this->getCurVal() . '" class="form-control">';
}
}
function render_text( $crop = false ) {
if ( !$this->getCurVal() ) return '0';
if ( $this->obj->attrs[$this->attr_name]['templ'] ) $c = true; else $c= false;
return nf($this->getCurVal(), $c);
}
}
?>