Merge pull request #4936 from monishdeb/INFRA-32
[civicrm-core.git] / CRM / Report / Form / Contribute / HouseholdSummary.php
index f011b1060ab353a5b60f4911ddd9d6a4fc6113d3..8f2a0db86f4e808a1313dc599bd6a794dc36e7d3 100644 (file)
@@ -1,8 +1,7 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -44,12 +43,10 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
   protected $_summary = NULL;
 
   /**
-   *
    */
   /**
-   *
    */
-  function __construct() {
+  public function __construct() {
     self::validRelationships();
 
     $config = CRM_Core_Config::singleton();
@@ -64,11 +61,10 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
       'civicrm_contact_household' => array(
         'dao' => 'CRM_Contact_DAO_Contact',
         'fields' => array(
-          'household_name' =>
-            array(
-              'title' => ts('Household Name'),
-              'required' => TRUE,
-            ),
+          'household_name' => array(
+            'title' => ts('Household Name'),
+            'required' => TRUE,
+          ),
           'id' => array(
             'no_display' => TRUE,
             'required' => TRUE,
@@ -77,7 +73,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
             'title' => ts('Contact Type'),
           ),
           'contact_sub_type' => array(
-            'title' => ts('Contact SubType'),
+            'title' => ts('Contact Subtype'),
           ),
         ),
         'filters' => array(
@@ -180,7 +176,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
       'civicrm_email' => array(
         'dao' => 'CRM_Core_DAO_Email',
         'fields' => array(
-          'email' => NULL
+          'email' => NULL,
         ),
         'grouping' => 'contact-fields',
       ),
@@ -201,16 +197,18 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     parent::__construct();
   }
 
-  function preProcess() {
+  public function preProcess() {
     parent::preProcess();
   }
 
-  function select() {
+  public function select() {
     $this->_columnHeaders = $select = array();
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $fieldName => $field) {
-          if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+          if (!empty($field['required']) ||
+            !empty($this->_params['fields'][$fieldName])
+          ) {
             if ($tableName == 'civicrm_address') {
               $this->_addressField = TRUE;
             }
@@ -239,7 +237,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     $this->_select = "SELECT " . implode(', ', $select) . " ";
   }
 
-  function from() {
+  public function from() {
 
     $this->_from = NULL;
     $this->_from = "
@@ -266,7 +264,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     }
   }
 
-  function where() {
+  public function where() {
     $clauses = array();
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('filters', $table)) {
@@ -283,7 +281,9 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
             $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
             if ($op) {
               if ($fieldName == 'relationship_type_id') {
-                $clause = "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" . $this->relationshipId;
+                $clause =
+                  "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" .
+                  $this->relationshipId;
               }
               else {
                 $clause = $this->whereClause($field,
@@ -315,11 +315,11 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     }
   }
 
-  function groupBy() {
+  public function groupBy() {
     $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_relationship']}.$this->householdContact, {$this->_aliases['civicrm_relationship']}.$this->otherContact , {$this->_aliases['civicrm_contribution']}.id, {$this->_aliases['civicrm_relationship']}.relationship_type_id ";
   }
 
-  function orderBy() {
+  public function orderBy() {
     $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_household']}.household_name, {$this->_aliases['civicrm_relationship']}.$this->householdContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact";
   }
 
@@ -328,7 +328,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
    *
    * @return array
    */
-  function statistics(&$rows) {
+  public function statistics(&$rows) {
     $statistics = parent::statistics($rows);
 
     //hack filter display for relationship type
@@ -345,10 +345,13 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     return $statistics;
   }
 
-  function postProcess() {
+  public function postProcess() {
 
     $this->beginPostProcess();
-    $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_household']));
+    $this->buildACLClause(array(
+      $this->_aliases['civicrm_contact'],
+      $this->_aliases['civicrm_contact_household'],
+    ));
     $sql = $this->buildQuery(TRUE);
     $rows = array();
 
@@ -361,7 +364,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
   /**
    * Set variables to be accessed by API and form layer in processing
    */
-  function beginPostProcessCommon() {
+  public function beginPostProcessCommon() {
     $getRelationship = $this->_params['relationship_type_id_value'];
     $type = substr($getRelationship, -3);
     $this->relationshipId = intval((substr($getRelationship, 0, strpos($getRelationship, '_'))));
@@ -375,7 +378,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     }
   }
 
-  function validRelationships() {
+  public function validRelationships() {
     $this->relationTypes = $relationTypes = array();
 
     $params = array('contact_type_b' => 'Household', 'version' => 3);
@@ -405,7 +408,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
   /**
    * @param $rows
    */
-  function alterDisplay(&$rows) {
+  public function alterDisplay(&$rows) {
     // custom code to alter rows
     $type = substr($this->_params['relationship_type_id_value'], -3);
 
@@ -422,7 +425,9 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
       }
 
       //remove duplicate Organization names
-      if (array_key_exists('civicrm_contact_household_household_name', $row) && $this->_outputMode != 'csv') {
+      if (array_key_exists('civicrm_contact_household_household_name', $row) &&
+        $this->_outputMode != 'csv'
+      ) {
         if ($value = $row['civicrm_contact_household_household_name']) {
           if ($rowNum == 0) {
             $priviousHousehold = $value;
@@ -448,14 +453,18 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
             );
 
             $rows[$rowNum]['civicrm_contact_household_household_name'] =
-              "<a href='$url' title='" . ts('View contact summary for this househould') . "'>" . $value . '</a>';
+              "<a href='$url' title='" .
+              ts('View contact summary for this househould') . "'>" . $value .
+              '</a>';
           }
           $entryFound = TRUE;
         }
       }
 
       //remove duplicate Contact names and relationship type
-      if (array_key_exists('civicrm_contact_id', $row) && $this->_outputMode != 'csv') {
+      if (array_key_exists('civicrm_contact_id', $row) &&
+        $this->_outputMode != 'csv'
+      ) {
         if ($value = $row['civicrm_contact_id']) {
           if ($rowNum == 0) {
             $priviousContact = $value;
@@ -526,7 +535,8 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
         CRM_Core_Permission::check('access CiviContribute')
       ) {
         $url = CRM_Utils_System::url("civicrm/contact/view/contribution",
-          "reset=1&id=" . $row['civicrm_contribution_id'] . "&cid=" . $row['civicrm_contact_id'] .
+          "reset=1&id=" . $row['civicrm_contribution_id'] . "&cid=" .
+          $row['civicrm_contact_id'] .
           "&action=view&context=contribution&selectedChild=contribute",
           $this->_absoluteUrl
         );
@@ -551,4 +561,3 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
     }
   }
 }
-