Fix Fatal error on membership detail report (with ACLs enabled) dev/core/#100
authoreileen <emcnaughton@wikimedia.org>
Tue, 8 May 2018 00:30:03 +0000 (12:30 +1200)
committereileen <emcnaughton@wikimedia.org>
Wed, 16 May 2018 20:26:54 +0000 (08:26 +1200)
CRM/Report/Form/Member/Detail.php
tests/phpunit/api/v3/ReportTemplateTest.php

index adedf9f8259ba4b738778239283e4ea33cfe14f5..9430c6fb600b97c64f271ef4f151d65d1239aefe 100644 (file)
@@ -303,22 +303,6 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form {
     }
   }
 
-  public function postProcess() {
-
-    $this->beginPostProcess();
-
-    // get the acl clauses built before we assemble the query
-    $this->buildACLClause($this->_aliases['civicrm_contact']);
-    $sql = $this->buildQuery(TRUE);
-
-    $rows = array();
-    $this->buildRows($sql, $rows);
-
-    $this->formatDisplay($rows);
-    $this->doTemplateAssignment($rows);
-    $this->endPostProcess($rows);
-  }
-
   /**
    * Alter display of rows.
    *
index 16ad8868bba6490261f6bf37db01c555d91b3bca..b759be8cd8700e6230525b9e4f581f38b7411aca 100644 (file)
@@ -157,6 +157,27 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * Test api to get rows from reports with ACLs enabled.
+   *
+   * Checking for lack of fatal error at the moment.
+   *
+   * @dataProvider getReportTemplates
+   *
+   * @param $reportID
+   *
+   * @throws \PHPUnit_Framework_IncompleteTestError
+   */
+  public function testReportTemplateGetRowsAllReportsACL($reportID) {
+    if (stristr($reportID, 'has existing issues')) {
+      $this->markTestIncomplete($reportID);
+    }
+    $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
+    $this->callAPISuccess('report_template', 'getrows', array(
+      'report_id' => $reportID,
+    ));
+  }
+
   /**
    * Test get statistics.
    *