CRM-15236 apply same fix to Household summary
authorEileen McNaughton <eileen@fuzion.co.nz>
Fri, 5 Sep 2014 00:30:34 +0000 (12:30 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 20 Oct 2014 07:22:01 +0000 (20:22 +1300)
CRM/Report/Form/Contribute/HouseholdSummary.php
CRM/Report/Form/Contribute/OrganizationSummary.php
tests/phpunit/api/v3/ReportTemplateTest.php

index 67c5867313c9ddb9cf30ea97b4b7e1a605293fda..f011b1060ab353a5b60f4911ddd9d6a4fc6113d3 100644 (file)
@@ -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() {
index 3abb35eac3fd50f58a8780b1ca8fcf33e9ade43a..d5f3b5b4303350d6f1c26f50d2f31455d12182ad 100644 (file)
@@ -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);
index 3bb1cddcb0f6108326f8966c5665803be2230440..5df8ae7dd0fdb6db42e120263aa037d1c5fbdb9f 100644 (file)
@@ -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',