From 8ea1d58d1237f02f428d1acb175664b4d742dc76 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Sat, 18 Jun 2016 03:33:56 +0530 Subject: [PATCH] CRM-18977, fixed code to invoke method in parent class ---------------------------------------- * CRM-18977: Contribution reports fails when Financial ACL is enabled https://issues.civicrm.org/jira/browse/CRM-18977 --- CRM/Report/Form.php | 3 +++ CRM/Report/Form/Contribute/Detail.php | 1 - CRM/Report/Form/Contribute/HouseholdSummary.php | 1 - CRM/Report/Form/Contribute/Lybunt.php | 1 - CRM/Report/Form/Contribute/OrganizationSummary.php | 1 - CRM/Report/Form/Contribute/Summary.php | 1 - CRM/Report/Form/Contribute/Sybunt.php | 6 +----- CRM/Report/Form/Contribute/TopDonor.php | 11 +---------- 8 files changed, 5 insertions(+), 20 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 9529e6d9eb..57145563eb 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -2622,6 +2622,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $this->from(); $this->customDataFrom(); $this->where(); + if (array_key_exists('civicrm_contribution', $this->getVar('_columns'))) { + $this->getPermissionedFTQuery($this); + } $this->groupBy(); $this->orderBy(); diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index 99270511a3..bb0d6e4a1a 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -382,7 +382,6 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom} INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id AND {$this->_aliases['civicrm_contribution']}.is_test = 0"; - $this->getPermissionedFTQuery($this); if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'both' diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php index 0c0b7f9654..4d7527f233 100644 --- a/CRM/Report/Form/Contribute/HouseholdSummary.php +++ b/CRM/Report/Form/Contribute/HouseholdSummary.php @@ -267,7 +267,6 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND {$this->_aliases['civicrm_email']}.is_primary = 1\n "; } - $this->getPermissionedFTQuery($this); } public function where() { diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index db26b325a9..3742669d16 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -611,7 +611,6 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { public function beginPostProcessCommon() { $this->buildQuery(); // @todo this acl has no test coverage and is very hard to test manually so could be fragile. - $this->getPermissionedFTQuery($this); $this->resetFormSqlAndWhereHavingClauses(); $this->contactTempTable = 'civicrm_report_temp_lybunt_c_' . date('Ymd_') . uniqid(); diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php index 0116c5a54e..ea7e20fd66 100644 --- a/CRM/Report/Form/Contribute/OrganizationSummary.php +++ b/CRM/Report/Form/Contribute/OrganizationSummary.php @@ -276,7 +276,6 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND {$this->_aliases['civicrm_email']}.is_primary = 1\n "; } - $this->getPermissionedFTQuery($this); } public function where() { diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 83564ec987..a7ed233695 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -485,7 +485,6 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { ON {$this->_aliases['civicrm_batch']}.entity_id = eft.financial_trxn_id AND {$this->_aliases['civicrm_batch']}.entity_table = 'civicrm_financial_trxn'\n"; } - $this->getPermissionedFTQuery($this); } /** diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index daf36b1e57..fae15cf5e6 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -432,11 +432,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { // get ready with post process params $this->beginPostProcess(); $this->buildACLClause($this->_aliases['civicrm_contact']); - $this->select(); - $this->from(); - $this->where(); - $this->groupBy(); - $this->getPermissionedFTQuery($this); + $this->buildQuery(); $rows = $contactIds = array(); if (empty($this->_params['charts'])) { diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php index 3e71627dc1..02362cd317 100644 --- a/CRM/Report/Form/Contribute/TopDonor.php +++ b/CRM/Report/Form/Contribute/TopDonor.php @@ -385,16 +385,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { // get the acl clauses built before we assemble the query $this->buildACLClause($this->_aliases['civicrm_contact']); - $this->select(); - - $this->from(); - $this->getPermissionedFTQuery($this); - - $this->where(); - - $this->groupBy(); - - $this->limit(); + $this->buildQuery(); //set the variable value rank, rows = 0 $setVariable = " SET @rows:=0, @rank=0 "; -- 2.25.1