Skip to content

Commit

Permalink
Merge pull request #20452 from jaapjansma/dev_financials_6_contactsum…
Browse files Browse the repository at this point in the history
…mary

dev/financial#6 Template contributions on the contact summary
  • Loading branch information
mattwire authored Jun 28, 2021
2 parents 5b51bc7 + 8c4ec32 commit 09042f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -2434,15 +2434,15 @@ public static function contributionCount($contactId, $includeSoftCredit = TRUE)
SELECT contribution.id AS id
FROM civicrm_contribution contribution
LEFT JOIN civicrm_line_item i ON i.contribution_id = contribution.id AND i.entity_table = 'civicrm_contribution' $liWhere
WHERE contribution.is_test = 0 AND contribution.contact_id = {$contactId}
WHERE contribution.is_test = 0 AND contribution.is_template != '1' AND contribution.contact_id = {$contactId}
$additionalWhere
AND i.id IS NULL";

$contactSoftCreditContributionsSQL = "
SELECT contribution.id
FROM civicrm_contribution contribution INNER JOIN civicrm_contribution_soft softContribution
ON ( contribution.id = softContribution.contribution_id )
WHERE contribution.is_test = 0 AND softContribution.contact_id = {$contactId} ";
WHERE contribution.is_test = 0 AND contribution.is_template != '1' AND softContribution.contact_id = {$contactId} ";
$query = "SELECT count( x.id ) count FROM ( ";
$query .= $contactContributionsSQL;

Expand Down
5 changes: 5 additions & 0 deletions CRM/Contribute/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ public function postProcess() {
// @todo - stop changing formValues - respect submitted form values, change a working array.
$this->_formValues['contribution_test'] = 0;
}
// We don't show template records in summaries or dashboards
if (empty($this->_formValues['is_template']) && $this->_force && !empty($this->_context) && ($this->_context === 'dashboard' || $this->_context === 'contribution')) {
// @todo - stop changing formValues - respect submitted form values, change a working array.
$this->_formValues['is_template'] = 0;
}

foreach ([
'contribution_amount_low',
Expand Down

0 comments on commit 09042f5

Please sign in to comment.