diff --git a/core/model/fieldtypes/Decimal.php b/core/model/fieldtypes/Decimal.php index b8d5ea301..a83b6afdc 100644 --- a/core/model/fieldtypes/Decimal.php +++ b/core/model/fieldtypes/Decimal.php @@ -44,4 +44,4 @@ class Decimal extends DBField { } } -?> \ No newline at end of file +?> diff --git a/core/model/fieldtypes/Percentage.php b/core/model/fieldtypes/Percentage.php index 65194aaa6..64d59a99a 100644 --- a/core/model/fieldtypes/Percentage.php +++ b/core/model/fieldtypes/Percentage.php @@ -20,12 +20,21 @@ class Percentage extends Decimal { if( !$precision ) $precision = 4; - parent::__construct($name, $precision, $precision); + parent::__construct($name, $precision + 1, $precision); } function Nice() { return number_format($this->value * 100, $this->decimalSize - 2) . '%'; } + + function saveInto($dataObject) { + parent::saveInto($dataObject); + + $fieldName = $this->name; + if($fieldName && $dataObject->$fieldName > 1.0) { + $dataObject->$fieldName = 1.0; + } + } } -?> \ No newline at end of file +?>