From 75f23035c42e5b351c61cf4de9953716f73c8c94 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 5 Sep 2014 12:30:34 +1200 Subject: [PATCH] CRM-15236 apply same fix to Household summary --- .../Form/Contribute/HouseholdSummary.php | 24 ++++++++++++------- .../Form/Contribute/OrganizationSummary.php | 3 +++ tests/phpunit/api/v3/ReportTemplateTest.php | 1 - 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php index 67c5867313..f011b1060a 100644 --- a/CRM/Report/Form/Contribute/HouseholdSummary.php +++ b/CRM/Report/Form/Contribute/HouseholdSummary.php @@ -98,7 +98,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $this->relationTypes, - 'default' => array(1), + 'default' => key($this->relationTypes), ), ), 'grouping' => 'household-fields', @@ -348,6 +348,20 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { function postProcess() { $this->beginPostProcess(); + $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_household'])); + $sql = $this->buildQuery(TRUE); + $rows = array(); + + $this->buildRows($sql, $rows); + $this->formatDisplay($rows); + $this->doTemplateAssignment($rows); + $this->endPostProcess($rows); + } + + /** + * Set variables to be accessed by API and form layer in processing + */ + function beginPostProcessCommon() { $getRelationship = $this->_params['relationship_type_id_value']; $type = substr($getRelationship, -3); $this->relationshipId = intval((substr($getRelationship, 0, strpos($getRelationship, '_')))); @@ -359,14 +373,6 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { $this->householdContact = 'contact_id_a'; $this->otherContact = 'contact_id_b'; } - $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_household'])); - $sql = $this->buildQuery(TRUE); - $rows = array(); - - $this->buildRows($sql, $rows); - $this->formatDisplay($rows); - $this->doTemplateAssignment($rows); - $this->endPostProcess($rows); } function validRelationships() { diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php index 3abb35eac3..d5f3b5b430 100644 --- a/CRM/Report/Form/Contribute/OrganizationSummary.php +++ b/CRM/Report/Form/Contribute/OrganizationSummary.php @@ -363,6 +363,9 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { $this->endPostProcess($rows); } + /** + * Set variables to be accessed by API and form layer in processing + */ function beginPostProcessCommon() { $getRelationship = $this->_params['relationship_type_id_value']; $type = substr($getRelationship, -3); diff --git a/tests/phpunit/api/v3/ReportTemplateTest.php b/tests/phpunit/api/v3/ReportTemplateTest.php index 3bb1cddcb0..5df8ae7dd0 100644 --- a/tests/phpunit/api/v3/ReportTemplateTest.php +++ b/tests/phpunit/api/v3/ReportTemplateTest.php @@ -173,7 +173,6 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { also, type should be added to state province & others? & potentially getAddressColumns fn should be used per other reports', 'contribute/repeat' => 'Reports with important functionality in postProcess are not callable via the api. For variable setting recommend beginPostProcessCommon, for temp table creation recommend From fn', - 'contribute/householdSummary' => '(see contribute/repeat) Undefined property: CRM_Report_Form_Contribute_HouseholdSummary::$householdContact LINE 260, property should be declared on class, for api accessibility should be set in beginPreProcess common', 'contribute/topDonor' => 'construction of query in postProcess makes inaccessible ', 'contribute/sybunt' => 'e notice - (ui gives fatal error at civicrm/report/contribute/sybunt&reset=1&force=1 e-notice is on yid_valueContribute/Sybunt.php(214) because at the force url "yid_relative" not "yid_value" is defined', -- 2.25.1