From: jitendrapurohit Date: Wed, 9 Mar 2016 06:51:47 +0000 (+0530) Subject: additional fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=879fda37d5a2176e469c90016c2cf99a28780c8a;p=civicrm-core.git additional fixes --- diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 0d6e85ee5a..bd7354d7fa 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -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(', ', $amount), diff --git a/templates/CRM/Contribute/Page/ContributionSoft.tpl b/templates/CRM/Contribute/Page/ContributionSoft.tpl index 3723de3d70..68c8363495 100644 --- a/templates/CRM/Contribute/Page/ContributionSoft.tpl +++ b/templates/CRM/Contribute/Page/ContributionSoft.tpl @@ -28,14 +28,14 @@ {if $context neq 'membership'} + {if $softCreditTotals.amount} - - {if $softCreditTotals.cancelAmount} + {/if} + {if $softCreditTotals.cancelAmount} - {/if} - + {/if}
{ts}Total Soft Credits{/ts} - {$softCreditTotals.amount|crmMoney:$softCreditTotals.currency}     {ts}Avg Soft Credits{/ts} - {$softCreditTotals.avg|crmMoney:$softCreditTotals.currency}   {ts}Total Cancelled Soft Credits{/ts} - {$softCreditTotals.cancelAmount|crmMoney:$softCreditTotals.currency}