diff --git a/Civi/DataProcessor/FieldOutputHandler/BoundedAggregateFunctionFieldOutputHandler.php b/Civi/DataProcessor/FieldOutputHandler/BoundedAggregateFunctionFieldOutputHandler.php index 93a44610eb12429cd82070f2b6a11d426c40368b..0940f6b98ca558088ab07d357be7ec6fb5c36f51 100644 --- a/Civi/DataProcessor/FieldOutputHandler/BoundedAggregateFunctionFieldOutputHandler.php +++ b/Civi/DataProcessor/FieldOutputHandler/BoundedAggregateFunctionFieldOutputHandler.php @@ -42,6 +42,11 @@ class BoundedAggregateFunctionFieldOutputHandler extends AggregateFunctionFieldO */ protected $maxValue = 0.00; + /** + * @var float + */ + protected $multiplier = 1; + /** * Initialize the processor * @@ -60,6 +65,9 @@ class BoundedAggregateFunctionFieldOutputHandler extends AggregateFunctionFieldO $this->maxBound = (float) $configuration['max_bound']; $this->maxValue = (float) $configuration['max_value']; } + if (!empty($configuration['multiplier']) && $configuration['multiplier'] != '1') { + $this->multiplier = (float) $configuration['multiplier']; + } } /** @@ -72,9 +80,13 @@ class BoundedAggregateFunctionFieldOutputHandler extends AggregateFunctionFieldO */ public function formatField($rawRecord, $formattedRecord) { $value = (float) $rawRecord[$this->aggregateField->alias]; - if ($this->minBound !== null && $value < $this->minBound) { + $pureValue = $value; + if ($this->multiplier > 0) { + $pureValue = $pureValue / $this->multiplier; + } + if ($this->minBound !== null && $pureValue < $this->minBound) { $value = $this->minValue; - } elseif ($this->maxBound !== null && $value > $this->maxBound) { + } elseif ($this->maxBound !== null && $pureValue > $this->maxBound) { $value = $this->maxValue; } elseif ($this->roundToNearestWholeNumber) { $value = $this->roundUpToNearest($value, $this->roundToNearestWholeNumber);