Skip to content

Commit

Permalink
Merge pull request #29654 from agileware/CIVICRM-2228
Browse files Browse the repository at this point in the history
Specify rounding mode when rendering Monetary entity tokens
  • Loading branch information
eileenmcnaughton authored Mar 8, 2024
2 parents 3d9e8c2 + d339569 commit 9134c20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CRM/Core/EntityTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Civi\ActionSchedule\Event\MailingQueryEvent;
use Civi\Token\TokenProcessor;
use Brick\Money\Money;
use Brick\Math\RoundingMode;

/**
* Class CRM_Core_EntityTokens
Expand Down Expand Up @@ -126,7 +127,7 @@ public function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL)
}

return $row->format('text/plain')->tokens($entity, $field,
Money::of($fieldValue, $currency));
Money::of($fieldValue, $currency, NULL, RoundingMode::HALF_UP));

}
if ($this->isDateField($field)) {
Expand Down

0 comments on commit 9134c20

Please sign in to comment.