From 0e9ac29b0fc899b462ae7253af4e69fa1bbed830 Mon Sep 17 00:00:00 2001 From: yashodha Date: Mon, 20 Feb 2023 15:21:54 +0530 Subject: [PATCH] (dev/core#4106) Add filter on pledge payment in contribution report templates --- CRM/Report/Form/Contribute/Detail.php | 15 +++++++++++++++ CRM/Report/Form/Contribute/Summary.php | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index 70965b4bd5..5ca489a392 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -255,6 +255,14 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { ], 'grouping' => 'contri-fields', ], + 'civicrm_pledge_payment' => [ + 'dao' => 'CRM_Pledge_DAO_PledgePayment', + 'filters' => [ + 'contribution_id' => [ + 'title' => ts('Contribution is a pledge payment'), + ], + ], + ], 'civicrm_contribution_soft' => [ 'dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => [ @@ -986,6 +994,13 @@ WHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu $this->joinAddressFromContact(); $this->joinEmailFromContact(); + //for pledge payment + if ($this->isTableSelected('civicrm_pledge_payment')) { + $this->_from .= " + LEFT JOIN civicrm_pledge_payment {$this->_aliases['civicrm_pledge_payment']} ON {$this->_aliases['civicrm_contribution']}.id = {$this->_aliases['civicrm_pledge_payment']}.contribution_id + "; + } + // include contribution note if (!empty($this->_params['fields']['contribution_note']) || !empty($this->_params['note_value']) diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index cb7a89af49..a9c0877878 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -284,6 +284,14 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { 'batch_id' => ['title' => ts('Batch Title')], ], ], + 'civicrm_pledge_payment' => [ + 'dao' => 'CRM_Pledge_DAO_PledgePayment', + 'filters' => [ + 'contribution_id' => [ + 'title' => ts('Contribution is a pledge payment'), + ], + ], + ], 'civicrm_contribution_soft' => [ 'dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => [ @@ -527,6 +535,13 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { $this->joinPhoneFromContact(); $this->joinEmailFromContact(); + //for pledge payment + if ($this->isTableSelected('civicrm_pledge_payment')) { + $this->_from .= " + LEFT JOIN civicrm_pledge_payment {$this->_aliases['civicrm_pledge_payment']} ON {$this->_aliases['civicrm_contribution']}.id = {$this->_aliases['civicrm_pledge_payment']}.contribution_id + "; + } + //for contribution batches if ($this->isTableSelected('civicrm_batch')) { $this->_from .= " -- 2.25.1