CRM-18977, fixed code to invoke method in parent class
authorPradeep Nayak <pradpnayak@gmail.com>
Fri, 17 Jun 2016 22:03:56 +0000 (03:33 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Fri, 22 Jul 2016 14:30:14 +0000 (20:00 +0530)
----------------------------------------
* CRM-18977: Contribution reports fails when Financial ACL is enabled
  https://issues.civicrm.org/jira/browse/CRM-18977

CRM/Report/Form.php
CRM/Report/Form/Contribute/Detail.php
CRM/Report/Form/Contribute/HouseholdSummary.php
CRM/Report/Form/Contribute/Lybunt.php
CRM/Report/Form/Contribute/OrganizationSummary.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Contribute/TopDonor.php

index 9529e6d9eb68d7ae03f971ba4e7c986cdc113859..57145563ebf21f63029dfe49f1987397dd9ff687 100644 (file)
@@ -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();
 
index 99270511a3a99f90287b877a4b20fd0ba6e5b0fb..bb0d6e4a1a9cc8dd114e4f2c25163269fa182ede 100644 (file)
@@ -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'
index 0c0b7f9654fdffbcf56c7c0009ea3ca84ff23116..4d7527f2336578775d057c3312340f618e987228 100644 (file)
@@ -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() {
index db26b325a90d5630f7800b823bb33b2c5022e2d1..3742669d164430e0d1d2e7d30e213e775b7840fe 100644 (file)
@@ -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();
index 0116c5a54ec281621b5f308308baa2b1cf9bd3d8..ea7e20fd669a64cfe51847925cfeccce45b206eb 100644 (file)
@@ -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() {
index 83564ec9871810a39693d54f8b827eafd613f519..a7ed233695083f858e39e0e50312895c2bae1de3 100644 (file)
@@ -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);
   }
 
   /**
index daf36b1e5729b0702bd02d0c012df278a31ca3a5..fae15cf5e6d6d1422d995c89d79d89254d0bac30 100644 (file)
@@ -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'])) {
index 3e71627dc1a765852f1ddb4f0338d4712f29eea3..02362cd317f6c0d27c034f35f85ef7bba6b988a0 100644 (file)
@@ -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 ";