From 0216be6bb347cd96211b1fca8142685f1d4c1cbd Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 8 May 2018 12:30:03 +1200 Subject: [PATCH] Fix Fatal error on membership detail report (with ACLs enabled) dev/core/#100 --- CRM/Report/Form/Member/Detail.php | 16 ---------------- tests/phpunit/api/v3/ReportTemplateTest.php | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CRM/Report/Form/Member/Detail.php b/CRM/Report/Form/Member/Detail.php index adedf9f825..9430c6fb60 100644 --- a/CRM/Report/Form/Member/Detail.php +++ b/CRM/Report/Form/Member/Detail.php @@ -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. * diff --git a/tests/phpunit/api/v3/ReportTemplateTest.php b/tests/phpunit/api/v3/ReportTemplateTest.php index 16ad8868bb..b759be8cd8 100644 --- a/tests/phpunit/api/v3/ReportTemplateTest.php +++ b/tests/phpunit/api/v3/ReportTemplateTest.php @@ -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. * -- 2.25.1