Skip to content

Commit

Permalink
Merge pull request #28099 from eileenmcnaughton/568
Browse files Browse the repository at this point in the history
Fix rc-unreleased regression - tax amount not loading
  • Loading branch information
eileenmcnaughton authored Nov 10, 2023
2 parents 85b4b94 + a66daaa commit e2976d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CRM/Price/BAO/PriceSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,12 @@ public static function getCachedPriceSetDetail(int $priceSetID): array {
->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);
Expand Down

0 comments on commit e2976d9

Please sign in to comment.