simplify
authordemeritcowboy <demeritcowboy@hotmail.com>
Fri, 4 Mar 2022 16:55:43 +0000 (11:55 -0500)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Fri, 4 Mar 2022 16:55:43 +0000 (11:55 -0500)
CRM/Contribute/Form/ContributionView.php
templates/CRM/Price/Page/LineItem.tpl

index 69022ec099796c0e21f2205f3c91b26372f28466..bdf3c50cc130139aecfe8e601afacb921f46fc8f 100644 (file)
@@ -44,10 +44,8 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
     $values = (array) $contribution;
     $contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $values['contribution_status_id']);
 
-    if (!isset($this->get_template_vars()['hookDiscount'])) {
-      $this->assign('hookDiscount', ['message' => '']);
-    }
     $this->addExpectedSmartyVariables([
+      'hookDiscount',
       'pricesetFieldsCount',
       'pcp_id',
       // currencySymbol maybe doesn't make sense but is probably old?
index c20fe0720275779b83551bab5c1ed614f4ece993..7bac227eb9b424965787d13112a9425fc55e286a 100644 (file)
   <div class="clear"></div>
 </div>
 
-{if $hookDiscount.message}
+{if $hookDiscount && $hookDiscount.message}
   <div class="crm-section hookDiscount-section">
     <em>({$hookDiscount.message})</em>
   </div>