additional fixes
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 9 Mar 2016 06:51:47 +0000 (12:21 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 9 Mar 2016 06:51:47 +0000 (12:21 +0530)
CRM/Contribute/BAO/ContributionSoft.php
templates/CRM/Contribute/Page/ContributionSoft.tpl

index 0d6e85ee5a696e6343625753582ef85b1973f417..bd7354d7fa51365b68592b48d7b3bbbd479fe51a 100644 (file)
@@ -243,9 +243,9 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio
    * @return array
    */
   public static function getSoftContributionTotals($contact_id, $isTest = 0) {
-    
+
     $whereClause = "AND cc.cancel_date IS NULL";
-    
+
     $query = "
     SELECT SUM(amount) as amount, AVG(total_amount) as average, cc.currency
     FROM civicrm_contribution_soft  ccs
@@ -271,17 +271,18 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio
         $currency[] = $cs->currency;
       }
     }
-    
+
     //to get cancel amount
     $cancelAmountWhereClause = "AND cc.cancel_date IS NOT NULL";
     $query = str_replace($whereClause, $cancelAmountWhereClause, $query);
     $cancelAmountSQL  = CRM_Core_DAO::executeQuery($query, $params);
     while ($cancelAmountSQL->fetch()) {
       if ($cancelAmountSQL->amount > 0) {
+        $count++;
         $cancelAmount[] = $cancelAmountSQL->amount;
       }
     }
-    
+
     if ($count > 0) {
       return array(
         implode(',&nbsp;', $amount),
index 3723de3d708668e50def5f724c65b26b51ea1bf8..68c8363495b6ca46e683fc361be62157c64572e3 100644 (file)
 {if $context neq 'membership'}
     <table class="form-layout-compressed">
         <tr>
+          {if $softCreditTotals.amount}
             <th class="contriTotalLeft">{ts}Total Soft Credits{/ts} - {$softCreditTotals.amount|crmMoney:$softCreditTotals.currency}</th>
             <th class="right" width="10px"> &nbsp; </th>
             <th class="right contriTotalRight"> &nbsp; {ts}Avg Soft Credits{/ts} - {$softCreditTotals.avg|crmMoney:$softCreditTotals.currency}</th>
-            
-            {if $softCreditTotals.cancelAmount}
+          {/if}
+          {if $softCreditTotals.cancelAmount}
             <th class="right contriTotalRight"> &nbsp; {ts}Total Cancelled Soft Credits{/ts} - {$softCreditTotals.cancelAmount|crmMoney:$softCreditTotals.currency}</th>
-            {/if}
-            
+          {/if}
         </tr>
     </table>
     <p></p>