From 6c8223f692c5da7c64fb03122fee95aa9204af03 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 adedf9f8259b..9430c6fb600b 100644 --- a/CRM/Report/Form/Member/Detail.php +++ b/CRM/Report/Form/Member/Detail.php @@ -303,22 +303,6 @@ public function from() { } } - 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 16ad8868bba6..b759be8cd870 100644 --- a/tests/phpunit/api/v3/ReportTemplateTest.php +++ b/tests/phpunit/api/v3/ReportTemplateTest.php @@ -157,6 +157,27 @@ public function testReportTemplateGetRowsAllReports($reportID) { )); } + /** + * 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. *