mirror of
https://github.com/processwire/processwire.git
synced 2025-08-23 06:44:38 +02:00
Fix issue processwire/processwire-issues#718 FieldtypeFloat float typecast in getPrecision() method
This commit is contained in:
@@ -104,6 +104,7 @@ class FieldtypeFloat extends Fieldtype {
|
||||
}
|
||||
|
||||
public static function getPrecision($value) {
|
||||
$value = (float) $value;
|
||||
$remainder = ceil($value) - $value;
|
||||
$precision = strlen(ltrim($remainder, '0., '));
|
||||
if(!$precision) $precision = 1;
|
||||
@@ -121,6 +122,7 @@ class FieldtypeFloat extends Fieldtype {
|
||||
|
||||
if(is_null($field->precision)) $field->precision = 2;
|
||||
|
||||
/** @var InputfieldInteger $f */
|
||||
$f = $this->modules->get('InputfieldInteger');
|
||||
$f->attr('name', 'precision');
|
||||
$f->label = $this->_('Number of decimal digits to round to');
|
||||
|
Reference in New Issue
Block a user