From: Eileen McNaughton Date: Fri, 10 Nov 2023 06:23:48 +0000 (+1300) Subject: Fix rc-unreleased regression - tax amount not loading X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a66daaa80d49c0f1a0e81764fa8d94555de888b8;p=civicrm-core.git Fix rc-unreleased regression - tax amount not loading --- diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 45fab04fa2..566ef3287a 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -801,9 +801,12 @@ WHERE id = %1"; ->addWhere('price_field_id', 'IN', array_keys($data['fields'])) ->setSelect($select) ->execute(); + $taxRates = CRM_Core_PseudoConstant::getTaxRates(); foreach ($options as $option) { // Add in visibility because Smarty templates expect it and it is hard to adjust them to colon format. $option['visibility'] = $option['visibility_id:name']; + $option['tax_rate'] = (float) ($taxRates[$option['financial_type_id']] ?? 0); + $option['tax_amount'] = (float) ($option['tax_rate'] ? CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($option['amount'], $option['tax_rate'])['tax_amount'] : 0); $data['fields'][$option['price_field_id']]['options'][$option['id']] = $option; } $cache->set($cacheKey, $data);