INFRA-132 comments to end with full stops
[civicrm-core.git] / CRM / Report / Form / Extended.php
index 27f553b44283f8ff6fe6f0d635f638a166a5804c..7effc2e17249e7223c8bd61797c7a2cb160625aa 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -45,26 +45,29 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    *
    */
-  /**
-   *
-   */
-  function __construct() {
+  public function __construct() {
     parent::__construct();
   }
 
-  function preProcess() {
+  /**
+   *
+   */
+  public function preProcess() {
     parent::preProcess();
   }
 
-  function select() {
+  /**
+   *
+   */
+  public function select() {
     parent::select();
   }
 
 
-  /*
+  /**
    * From clause build where baseTable & fromClauses are defined
    */
-  function from() {
+  public function from() {
     if (!empty($this->_baseTable)) {
       $this->buildACLClause($this->_aliases['civicrm_contact']);
       $this->_from = "FROM {$this->_baseTable}   {$this->_aliases[$this->_baseTable]}";
@@ -79,17 +82,16 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     }
   }
 
-  /*
-   * Define any from clauses in use (child classes to override)
-   */
   /**
+   * Define any from clauses in use (child classes to override)
+   *
    * @return array
    */
-  function fromClauses() {
+  public function fromClauses() {
     return array();
   }
 
-  function groupBy() {
+  public function groupBy() {
     parent::groupBy();
     //@todo - need to re-visit this - bad behaviour from pa
     if ($this->_groupBy == 'GROUP BY') {
@@ -105,20 +107,20 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     }
   }
 
-  function orderBy() {
+  public function orderBy() {
     parent::orderBy();
   }
 
   /**
-   * @param $rows
+   * @param array $rows
    *
    * @return array
    */
-  function statistics(&$rows) {
+  public function statistics(&$rows) {
     return parent::statistics($rows);
   }
 
-  function postProcess() {
+  public function postProcess() {
     if (!empty($this->_aclTable) && !empty($this->_aliases[$this->_aclTable])) {
       $this->buildACLClause($this->_aliases[$this->_aclTable]);
     }
@@ -126,9 +128,15 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   }
 
   /**
-   * @param $rows
+   * Alter display of rows.
+   *
+   * Iterate through the rows retrieved via SQL and make changes for display purposes,
+   * such as rendering contacts as links.
+   *
+   * @param array $rows
+   *   Rows generated by SQL, with an array for each row.
    */
-  function alterDisplay(&$rows) {
+  public function alterDisplay(&$rows) {
     parent::alterDisplay($rows);
 
     //THis is all generic functionality which can hopefully go into the parent class
@@ -145,8 +153,11 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     foreach ($this->_columns as $tablename => $table) {
       if (array_key_exists('fields', $table)) {
         foreach ($table['fields'] as $field => $specs) {
-          if (in_array($tablename . '_' . $field, $selectedFields) && array_key_exists('alter_display', $specs)) {
-            $alterfunctions[$tablename . '_' . $field] = $specs['alter_display'];
+          if (in_array($tablename . '_' . $field, $selectedFields) &&
+            array_key_exists('alter_display', $specs)
+          ) {
+            $alterfunctions[$tablename . '_' .
+            $field] = $specs['alter_display'];
             $altermap[$tablename . '_' . $field] = $field;
           }
         }
@@ -169,96 +180,85 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getLineItemColumns() {
+  public function getLineItemColumns() {
     return array(
-      'civicrm_line_item' =>
-      array(
+      'civicrm_line_item' => array(
         'dao' => 'CRM_Price_BAO_LineItem',
-        'fields' =>
-        array(
-          'qty' =>
-          array('title' => ts('Quantity'),
+        'fields' => array(
+          'qty' => array(
+            'title' => ts('Quantity'),
             'type' => CRM_Utils_Type::T_INT,
-            'statistics' =>
-            array('sum' => ts('Total Quantity Selected')),
+            'statistics' => array('sum' => ts('Total Quantity Selected')),
           ),
-          'unit_price' =>
-          array('title' => ts('Unit Price'),
+          'unit_price' => array(
+            'title' => ts('Unit Price'),
           ),
-          'line_total' =>
-          array('title' => ts('Line Total'),
+          'line_total' => array(
+            'title' => ts('Line Total'),
             'type' => CRM_Utils_Type::T_MONEY,
-            'statistics' =>
-            array('sum' => ts('Total of Line Items')),
+            'statistics' => array('sum' => ts('Total of Line Items')),
           ),
         ),
-        'participant_count' =>
-        array('title' => ts('Participant Count'),
-          'statistics' =>
-          array('sum' => ts('Total Participants')),
+        'participant_count' => array(
+          'title' => ts('Participant Count'),
+          'statistics' => array('sum' => ts('Total Participants')),
         ),
-        'filters' =>
-        array(
-          'qty' =>
-          array('title' => ts('Quantity'),
+        'filters' => array(
+          'qty' => array(
+            'title' => ts('Quantity'),
             'type' => CRM_Utils_Type::T_INT,
             'operator' => CRM_Report_Form::OP_INT,
           ),
         ),
-        'group_bys' =>
-        array(
-          'price_field_id' =>
-          array('title' => ts('Price Field'),
+        'group_bys' => array(
+          'price_field_id' => array(
+            'title' => ts('Price Field'),
           ),
-          'price_field_value_id' =>
-          array('title' => ts('Price Field Option'),
+          'price_field_value_id' => array(
+            'title' => ts('Price Field Option'),
           ),
-          'line_item_id' =>
-          array('title' => ts('Individual Line Item'),
+          'line_item_id' => array(
+            'title' => ts('Individual Line Item'),
             'name' => 'id',
+          ),
         ),
       ),
-      ),
     );
   }
 
   /**
    * @return array
    */
-  function getPriceFieldValueColumns() {
+  public function getPriceFieldValueColumns() {
     return array(
-      'civicrm_price_field_value' =>
-      array(
+      'civicrm_price_field_value' => array(
         'dao' => 'CRM_Price_BAO_PriceFieldValue',
         'fields' => array(
-          'price_field_value_label' =>
-          array('title' => ts('Price Field Value Label'),
+          'price_field_value_label' => array(
+            'title' => ts('Price Field Value Label'),
             'name' => 'label',
           ),
         ),
-        'filters' =>
-        array(
-          'price_field_value_label' =>
-          array('title' => ts('Price Fields Value Label'),
+        'filters' => array(
+          'price_field_value_label' => array(
+            'title' => ts('Price Fields Value Label'),
             'type' => CRM_Utils_Type::T_STRING,
             'operator' => 'like',
             'name' => 'label',
           ),
         ),
-        'order_bys' =>
-        array(
-          'label' =>
-          array('title' => ts('Price Field Value Label'),
+        'order_bys' => array(
+          'label' => array(
+            'title' => ts('Price Field Value Label'),
           ),
         ),
-        'group_bys' =>
-        //note that we have a requirement to group by label such that all 'Promo book' lines
+        'group_bys' => //note that we have a requirement to group by label such that all 'Promo book' lines
         // are grouped together across price sets but there may be a separate need to group
         // by id so that entries in one price set are distinct from others. Not quite sure what
         // to call the distinction for end users benefit
         array(
-          'price_field_value_label' =>
-          array('title' => ts('Price Field Value Label'),
+          'price_field_value_label' => array(
+            'title' => ts('Price Field Value Label'),
             'name' => 'label',
           ),
         ),
@@ -269,38 +269,33 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getPriceFieldColumns() {
+  public function getPriceFieldColumns() {
     return array(
-      'civicrm_price_field' =>
-      array(
+      'civicrm_price_field' => array(
         'dao' => 'CRM_Price_BAO_PriceField',
-        'fields' =>
-        array(
-          'price_field_label' =>
-          array('title' => ts('Price Field Label'),
+        'fields' => array(
+          'price_field_label' => array(
+            'title' => ts('Price Field Label'),
             'name' => 'label',
           ),
         ),
-        'filters' =>
-        array(
-          'price_field_label' =>
-          array('title' => ts('Price Field Label'),
+        'filters' => array(
+          'price_field_label' => array(
+            'title' => ts('Price Field Label'),
             'type' => CRM_Utils_Type::T_STRING,
             'operator' => 'like',
             'name' => 'label',
           ),
         ),
-        'order_bys' =>
-        array(
-          'price_field_label' =>
-          array('title' => ts('Price Field Label'),
-                'name' => 'label',
+        'order_bys' => array(
+          'price_field_label' => array(
+            'title' => ts('Price Field Label'),
+            'name' => 'label',
           ),
         ),
-        'group_bys' =>
-        array(
-          'price_field_label' =>
-          array('title' => ts('Price Field Label'),
+        'group_bys' => array(
+          'price_field_label' => array(
+            'title' => ts('Price Field Label'),
             'name' => 'label',
           ),
         ),
@@ -311,29 +306,31 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getParticipantColumns() {
+  public function getParticipantColumns() {
     static $_events = array();
     if (!isset($_events['all'])) {
       CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
     }
     return array(
-      'civicrm_participant' =>
-      array(
+      'civicrm_participant' => array(
         'dao' => 'CRM_Event_DAO_Participant',
-        'fields' =>
-        array('participant_id' => array('title' => 'Participant ID'),
+        'fields' => array(
+          'participant_id' => array('title' => 'Participant ID'),
           'participant_record' => array(
             'name' => 'id',
             'title' => ts('Participant ID'),
           ),
-          'event_id' => array('title' => ts('Event ID'),
+          'event_id' => array(
+            'title' => ts('Event ID'),
             'type' => CRM_Utils_Type::T_STRING,
             'alter_display' => 'alterEventID',
           ),
-          'status_id' => array('title' => ts('Status'),
+          'status_id' => array(
+            'title' => ts('Status'),
             'alter_display' => 'alterParticipantStatus',
           ),
-          'role_id' => array('title' => ts('Role'),
+          'role_id' => array(
+            'title' => ts('Role'),
             'alter_display' => 'alterParticipantRole',
           ),
           'participant_fee_level' => NULL,
@@ -341,9 +338,9 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
           'participant_register_date' => array('title' => ts('Registration Date')),
         ),
         'grouping' => 'event-fields',
-        'filters' =>
-        array(
-          'event_id' => array('name' => 'event_id',
+        'filters' => array(
+          'event_id' => array(
+            'name' => 'event_id',
             'title' => ts('Event'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => $_events['all'],
@@ -365,15 +362,15 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'operatorType' => CRM_Report_Form::OP_DATE,
           ),
         ),
-        'order_bys' =>
-        array(
-          'event_id' =>
-          array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'),
+        'order_bys' => array(
+          'event_id' => array(
+            'title' => ts('Event'),
+            'default_weight' => '1',
+            'default_order' => 'ASC',
+          ),
         ),
-        'group_bys' =>
-        array(
-          'event_id' =>
-          array('title' => ts('Event')),
+        'group_bys' => array(
+          'event_id' => array('title' => ts('Event')),
         ),
       ),
     );
@@ -382,7 +379,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getMembershipColumns() {
+  public function getMembershipColumns() {
     return array(
       'civicrm_membership' => array(
         'dao' => 'CRM_Member_DAO_Membership',
@@ -424,7 +421,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getMembershipTypeColumns() {
+  public function getMembershipTypeColumns() {
     return array(
       'civicrm_membership_type' => array(
         'dao' => 'CRM_Member_DAO_MembershipType',
@@ -445,28 +442,31 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getEventColumns() {
+  public function getEventColumns() {
     return array(
       'civicrm_event' => array(
         'dao' => 'CRM_Event_DAO_Event',
-        'fields' =>
-        array(
+        'fields' => array(
           'id' => array(
             'no_display' => TRUE,
             'required' => TRUE,
           ),
-          'title' => array('title' => ts('Event Title'),
+          'title' => array(
+            'title' => ts('Event Title'),
             'required' => TRUE,
           ),
-          'event_type_id' => array('title' => ts('Event Type'),
+          'event_type_id' => array(
+            'title' => ts('Event Type'),
             'required' => TRUE,
             'alter_display' => 'alterEventType',
           ),
           'fee_label' => array('title' => ts('Fee Label')),
-          'event_start_date' => array('title' => ts('Event Start Date'),
-        ),
+          'event_start_date' => array(
+            'title' => ts('Event Start Date'),
+          ),
           'event_end_date' => array('title' => ts('Event End Date')),
-          'max_participants' => array('title' => ts('Capacity'),
+          'max_participants' => array(
+            'title' => ts('Capacity'),
             'type' => CRM_Utils_Type::T_INT,
           ),
         ),
@@ -493,8 +493,8 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
         ),
         'group_bys' => array(
           'event_type_id' => array(
-          'title' => ts('Event Type'),
-      ),
+            'title' => ts('Event Type'),
+          ),
         ),
       ),
     );
@@ -503,21 +503,21 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getContributionColumns() {
+  public function getContributionColumns() {
     return array(
-      'civicrm_contribution' =>
-      array(
+      'civicrm_contribution' => array(
         'dao' => 'CRM_Contribute_DAO_Contribution',
-        'fields' =>
-        array(
+        'fields' => array(
           'contribution_id' => array(
             'name' => 'id',
           ),
-          'financial_type_id' => array('title' => ts('Financial Type'),
+          'financial_type_id' => array(
+            'title' => ts('Financial Type'),
             'default' => TRUE,
             'alter_display' => 'alterContributionType',
           ),
-          'payment_instrument_id' => array('title' => ts('Payment Instrument'),
+          'payment_instrument_id' => array(
+            'title' => ts('Payment Instrument'),
             'alter_display' => 'alterPaymentType',
           ),
           'source' => array('title' => 'Contribution Source'),
@@ -526,52 +526,46 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
           'receipt_date' => NULL,
           'fee_amount' => NULL,
           'net_amount' => NULL,
-          'total_amount' => array('title' => ts('Amount'),
-            'statistics' =>
-            array('sum' => ts('Total Amount')),
+          'total_amount' => array(
+            'title' => ts('Amount'),
+            'statistics' => array('sum' => ts('Total Amount')),
             'type' => CRM_Utils_Type::T_MONEY,
           ),
         ),
-        'filters' =>
-        array(
-          'receive_date' =>
-          array('operatorType' => CRM_Report_Form::OP_DATE),
-          'financial_type_id' =>
-          array('title' => ts('Financial Type'),
+        'filters' => array(
+          'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE),
+          'financial_type_id' => array(
+            'title' => ts('Financial Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::financialType(),
           ),
-          'payment_instrument_id' =>
-          array('title' => ts('Payment Type'),
+          'payment_instrument_id' => array(
+            'title' => ts('Payment Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
           ),
-          'contribution_status_id' =>
-          array('title' => ts('Contribution Status'),
+          'contribution_status_id' => array(
+            'title' => ts('Contribution Status'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
           ),
-          'total_amount' =>
-          array('title' => ts('Contribution Amount')),
+          'total_amount' => array('title' => ts('Contribution Amount')),
         ),
-        'order_bys' =>
-        array(
-          'payment_instrument_id' =>
-          array('title' => ts('Payment Instrument'),
+        'order_bys' => array(
+          'payment_instrument_id' => array(
+            'title' => ts('Payment Instrument'),
+          ),
+          'financial_type_id' => array(
+            'title' => ts('Financial Type'),
           ),
-         'financial_type_id' =>
-          array('title' => ts('Financial Type'),
-        ),
         ),
-        'group_bys' =>
-        array('financial_type_id' =>
-          array('title' => ts('Financial Type')),
-          'payment_instrument_id' =>
-          array('title' => ts('Payment Instrument')),
-          'contribution_id' =>
-          array('title' => ts('Individual Contribution'),
+        'group_bys' => array(
+          'financial_type_id' => array('title' => ts('Financial Type')),
+          'payment_instrument_id' => array('title' => ts('Payment Instrument')),
+          'contribution_id' => array(
+            'title' => ts('Individual Contribution'),
             'name' => 'id',
-        ),
+          ),
           'source' => array('title' => 'Contribution Source'),
         ),
         'grouping' => 'contribution-fields',
@@ -582,7 +576,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getContactColumns() {
+  public function getContactColumns() {
     return array(
       'civicrm_contact' => array(
         'dao' => 'CRM_Contact_DAO_Contact',
@@ -608,8 +602,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
         'filters' => array(
           'id' => array(
             'title' => ts('Contact ID'),
-          )
-          ,
+          ),
           'sort_name' => array(
             'title' => ts('Contact Name'),
           ),
@@ -630,48 +623,48 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   /**
    * @return array
    */
-  function getCaseColumns() {
+  public function getCaseColumns() {
     return array(
       'civicrm_case' => array(
         'dao' => 'CRM_Case_DAO_Case',
         'fields' => array(
           'id' => array(
             'title' => ts('Case ID'),
-            'required' => false
+            'required' => FALSE,
           ),
           'subject' => array(
             'title' => ts('Case Subject'),
-            'default' => true
+            'default' => TRUE,
           ),
           'status_id' => array(
             'title' => ts('Status'),
-            'default' => true
+            'default' => TRUE,
           ),
           'case_type_id' => array(
             'title' => ts('Case Type'),
-            'default' => true
+            'default' => TRUE,
           ),
           'case_start_date' => array(
             'title' => ts('Case Start Date'),
             'name' => 'start_date',
-            'default' => true
+            'default' => TRUE,
           ),
           'case_end_date' => array(
             'title' => ts('Case End Date'),
             'name' => 'end_date',
-            'default' => true
+            'default' => TRUE,
           ),
           'case_duration' => array(
             'name' => 'duration',
             'title' => ts('Duration (Days)'),
-            'default' => false
+            'default' => FALSE,
           ),
           'case_is_deleted' => array(
             'name' => 'is_deleted',
             'title' => ts('Case Deleted?'),
-            'default' => false,
-            'type' => CRM_Utils_Type::T_INT
-          )
+            'default' => FALSE,
+            'type' => CRM_Utils_Type::T_INT,
+          ),
         ),
         'filters' => array(
           'case_start_date' => array(
@@ -684,18 +677,18 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'title' => ts('Case End Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
             'type' => CRM_Utils_Type::T_DATE,
-            'name' => 'end_date'
+            'name' => 'end_date',
           ),
           'case_type_id' => array(
             'title' => ts('Case Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => $this->case_types
+            'options' => $this->case_types,
           ),
           'case_status_id' => array(
             'title' => ts('Case Status'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => $this->case_statuses,
-            'name' => 'status_id'
+            'name' => 'status_id',
           ),
           'case_is_deleted' => array(
             'title' => ts('Case Deleted?'),
@@ -703,49 +696,41 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'operatorType' => CRM_Report_Form::OP_SELECT,
             'options' => $this->deleted_labels,
             'default' => 0,
-            'name' => 'is_deleted'
-          )
-        )
-      )
+            'name' => 'is_deleted',
+          ),
+        ),
+      ),
     );
   }
 
-  /*
-   * adding address fields to construct function in reports
-   * @param array $options Options for the report
-   * - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
-   * - prefix_label optional prefix lable eg. "Honoree " for front end
-   * - group_by enable these fields for group by - default false
-   * - order_by enable these fields for order by
-   * - filters enable these fields for filtering
-   * - defaults - (is this working?) values to pre-populate
-   * @return array address fields for construct clause
-   */
-  /**
-   * Get address columns to add to array
-   * @param array $options
-   *  - prefix Prefix to add to table (in case of more than one instance of the table)
-   *  - prefix_label Label to give columns from this address table instance
-   * @return array address columns definition
-   */
   /**
+   * Get address columns to add to array.
+   *
    * @param array $options
+   *   Options for the report.
+   *   - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
+   *   - prefix_label optional prefix lable eg. "Honoree " for front end
+   *   - group_by enable these fields for group by - default false
+   *   - order_by enable these fields for order by
+   *   - filters enable these fields for filtering
+   *   - defaults - (is this working?) values to pre-populate
    *
    * @return array
+   *   address columns definition
    */
-  function getAddressColumns($options = array()) {
+  public function getAddressColumns($options = array()) {
     $defaultOptions = array(
       'prefix' => '',
       'prefix_label' => '',
-      'group_by' => false,
-      'order_by' => true,
-      'filters' => true,
+      'group_by' => FALSE,
+      'order_by' => TRUE,
+      'filters' => TRUE,
       'defaults' => array(
-        'country_id' => TRUE
+        'country_id' => TRUE,
       ),
-     );
+    );
 
-    $options = array_merge($defaultOptions,$options);
+    $options = array_merge($defaultOptions, $options);
 
     $addressFields = array(
       $options['prefix'] . 'civicrm_address' => array(
@@ -764,12 +749,14 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'name' => 'street_address',
           ),
           $options['prefix'] . 'supplemental_address_1' => array(
-            'title' => ts($options['prefix_label'] . 'Supplementary Address Field 1'),
+            'title' => ts($options['prefix_label'] .
+              'Supplementary Address Field 1'),
             'default' => CRM_Utils_Array::value('supplemental_address_1', $options['defaults'], FALSE),
             'name' => 'supplemental_address_1',
           ),
           $options['prefix'] . 'supplemental_address_2' => array(
-            'title' => ts($options['prefix_label'] . 'Supplementary Address Field 2'),
+            'title' => ts($options['prefix_label'] .
+              'Supplementary Address Field 2'),
             'default' => CRM_Utils_Array::value('supplemental_address_2', $options['defaults'], FALSE),
             'name' => 'supplemental_address_2',
           ),
@@ -778,21 +765,18 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'title' => ts($options['prefix_label'] . 'Street Number'),
             'type' => 1,
             'default' => CRM_Utils_Array::value('street_number', $options['defaults'], FALSE),
-            'name' => 'street_number',
           ),
           $options['prefix'] . 'street_name' => array(
             'name' => 'street_name',
             'title' => ts($options['prefix_label'] . 'Street Name'),
             'type' => 1,
             'default' => CRM_Utils_Array::value('street_name', $options['defaults'], FALSE),
-            'name' => 'street_name',
           ),
           $options['prefix'] . 'street_unit' => array(
             'name' => 'street_unit',
             'title' => ts($options['prefix_label'] . 'Street Unit'),
             'type' => 1,
             'default' => CRM_Utils_Array::value('street_unit', $options['defaults'], FALSE),
-            'name' => 'street_unit',
           ),
           $options['prefix'] . 'city' => array(
             'title' => ts($options['prefix_label'] . 'City'),
@@ -814,7 +798,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'title' => ts($options['prefix_label'] . 'State/Province'),
             'default' => CRM_Utils_Array::value('state_province_id', $options['defaults'], FALSE),
             'alter_display' => 'alterStateProvinceID',
-            'name' =>  'state_province_id',
+            'name' => 'state_province_id',
           ),
           $options['prefix'] . 'country_id' => array(
             'title' => ts($options['prefix_label'] . 'Country'),
@@ -828,7 +812,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     );
 
     if ($options['filters']) {
-      $addressFields[$options['prefix'] .'civicrm_address']['filters'] = array(
+      $addressFields[$options['prefix'] . 'civicrm_address']['filters'] = array(
         $options['prefix'] . 'street_number' => array(
           'title' => ts($options['prefix_label'] . 'Street Number'),
           'type' => 1,
@@ -874,7 +858,8 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     }
 
     if ($options['order_by']) {
-      $addressFields[$options['prefix'] . 'civicrm_address']['order_bys'] = array(
+      $addressFields[$options['prefix'] .
+      'civicrm_address']['order_bys'] = array(
         $options['prefix'] . 'street_name' => array(
           'title' => ts($options['prefix_label'] . 'Street Name'),
           'name' => 'street_name',
@@ -929,13 +914,12 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     return $addressFields;
   }
 
-  /*
-   * Get Information about advertised Joins
-   */
   /**
+   * Get Information about advertised Joins.
+   *
    * @return array
    */
-  function getAvailableJoins() {
+  public function getAvailableJoins() {
     return array(
       'priceFieldValue_from_lineItem' => array(
         'leftTable' => 'civicrm_line_item',
@@ -1020,45 +1004,47 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     );
   }
 
-  /*
+  /**
    * Add join from contact table to address. Prefix will be added to both tables
    * as it's assumed you are using it to get address of a secondary contact
-   */
-  /**
+   *
    * @param string $prefix
    */
-  function joinAddressFromContact( $prefix = '') {
-    $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix . 'civicrm_address']}
-      ON {$this->_aliases[$prefix . 'civicrm_address']}.contact_id = {$this->_aliases[$prefix . 'civicrm_contact']}.id";
+  public function joinAddressFromContact($prefix = '') {
+    $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix .
+    'civicrm_address']}
+      ON {$this->_aliases[$prefix .
+    'civicrm_address']}.contact_id = {$this->_aliases[$prefix .
+    'civicrm_contact']}.id";
   }
 
-  function joinPriceFieldValueFromLineItem() {
+  public function joinPriceFieldValueFromLineItem() {
     $this->_from .= " LEFT JOIN civicrm_price_field_value {$this->_aliases['civicrm_price_field_value']}
                           ON {$this->_aliases['civicrm_line_item']}.price_field_value_id = {$this->_aliases['civicrm_price_field_value']}.id";
   }
 
-  function joinPriceFieldFromLineItem() {
+  public function joinPriceFieldFromLineItem() {
     $this->_from .= "
        LEFT JOIN civicrm_price_field {$this->_aliases['civicrm_price_field']}
       ON {$this->_aliases['civicrm_line_item']}.price_field_id = {$this->_aliases['civicrm_price_field']}.id
      ";
   }
 
-  /*
-   * Define join from line item table to participant table
+  /**
+   * Define join from line item table to participant table.
    */
-  function joinParticipantFromLineItem() {
+  public function joinParticipantFromLineItem() {
     $this->_from .= " LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
       ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_participant']}.id
       AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant')
     ";
   }
 
-  /*
+  /**
    * Define join from line item table to Membership table. Seems to be still via contribution
    * as the entity. Have made 'inner' to restrict does that make sense?
    */
-  function joinMembershipFromLineItem() {
+  public function joinMembershipFromLineItem() {
     $this->_from .= " INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
       ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_contribution']}.id
       AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_contribution')
@@ -1069,10 +1055,10 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     ";
   }
 
-  /*
-   * Define join from Participant to Contribution table
+  /**
+   * Define join from Participant to Contribution table.
    */
-  function joinContributionFromParticipant() {
+  public function joinContributionFromParticipant() {
     $this->_from .= " LEFT JOIN civicrm_participant_payment pp
         ON {$this->_aliases['civicrm_participant']}.id = pp.participant_id
         LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
@@ -1080,10 +1066,10 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
       ";
   }
 
-  /*
-   * Define join from Membership to Contribution table
+  /**
+   * Define join from Membership to Contribution table.
    */
-  function joinContributionFromMembership() {
+  public function joinContributionFromMembership() {
     $this->_from .= " LEFT JOIN civicrm_membership_payment pp
         ON {$this->_aliases['civicrm_membership']}.id = pp.membership_id
         LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
@@ -1091,14 +1077,14 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
       ";
   }
 
-  function joinParticipantFromContribution() {
+  public function joinParticipantFromContribution() {
     $this->_from .= " LEFT JOIN civicrm_participant_payment pp
                           ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
         LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
                           ON pp.participant_id = {$this->_aliases['civicrm_participant']}.id";
   }
 
-  function joinMembershipFromContribution() {
+  public function joinMembershipFromContribution() {
     $this->_from .= "
        LEFT JOIN civicrm_membership_payment pp
       ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
@@ -1106,14 +1092,14 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
       ON pp.membership_id = {$this->_aliases['civicrm_membership']}.id";
   }
 
-  function joinMembershipTypeFromMembership() {
+  public function joinMembershipTypeFromMembership() {
     $this->_from .= "
        LEFT JOIN civicrm_membership_type {$this->_aliases['civicrm_membership_type']}
       ON {$this->_aliases['civicrm_membership']}.membership_type_id = {$this->_aliases['civicrm_membership_type']}.id
       ";
   }
 
-  function joinContributionFromLineItem() {
+  public function joinContributionFromLineItem() {
 
     // this can be stored as a temp table & indexed for more speed. Not done at this state.
     // another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
@@ -1149,7 +1135,7 @@ LEFT JOIN civicrm_membership_payment pp
  ";
   }
 
-  function joinLineItemFromContribution() {
+  public function joinLineItemFromContribution() {
 
     // this can be stored as a temp table & indexed for more speed. Not done at this stage.
     // another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
@@ -1183,7 +1169,7 @@ WHERE   line_item_civireport.id IS NOT NULL
   ";
   }
 
-  function joinLineItemFromMembership() {
+  public function joinLineItemFromMembership() {
 
     // this can be stored as a temp table & indexed for more speed. Not done at this stage.
     // another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
@@ -1209,40 +1195,39 @@ WHERE   line_item_civireport.id IS NOT NULL
   ";
   }
 
-  function joinContactFromParticipant() {
+  public function joinContactFromParticipant() {
     $this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
                           ON {$this->_aliases['civicrm_participant']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
   }
 
-  function joinContactFromMembership() {
+  public function joinContactFromMembership() {
     $this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
                           ON {$this->_aliases['civicrm_membership']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
   }
 
-  function joinContactFromContribution() {
+  public function joinContactFromContribution() {
     $this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
                           ON {$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
   }
 
-  function joinEventFromParticipant() {
+  public function joinEventFromParticipant() {
     $this->_from .= "  LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
                     ON ({$this->_aliases['civicrm_event']}.id = {$this->_aliases['civicrm_participant']}.event_id ) AND
                        ({$this->_aliases['civicrm_event']}.is_template IS NULL OR
                         {$this->_aliases['civicrm_event']}.is_template = 0)";
   }
 
-  /*
-    * Retrieve text for financial type from pseudoconstant
-    */
   /**
+   * Retrieve text for financial type from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return string
    */
-  function alterNickName($value, &$row) {
-    if(empty($row['civicrm_contact_id'])){
-      return;
+  public function alterNickName($value, &$row) {
+    if (empty($row['civicrm_contact_id'])) {
+      return NULL;
     }
     $contactID = $row['civicrm_contact_id'];
     return "<div id=contact-{$contactID} class='crm-entity'>
@@ -1250,139 +1235,140 @@ WHERE   line_item_civireport.id IS NOT NULL
            " . $value . "</span></div>";
   }
 
-  /*
-   * Retrieve text for contribution type from pseudoconstant
-   */
   /**
+   * Retrieve text for contribution type from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
-  function alterContributionType($value, &$row) {
+  public function alterContributionType($value, &$row) {
     return is_string(CRM_Contribute_PseudoConstant::financialType($value, FALSE)) ? CRM_Contribute_PseudoConstant::financialType($value, FALSE) : '';
   }
 
-  /*
-   * Retrieve text for contribution status from pseudoconstant
-   */
   /**
+   * Retrieve text for contribution status from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array
    */
-  function alterContributionStatus($value, &$row) {
+  public function alterContributionStatus($value, &$row) {
     return CRM_Contribute_PseudoConstant::contributionStatus($value);
   }
 
-  /*
-   * Retrieve text for payment instrument from pseudoconstant
-   */
   /**
+   * Retrieve text for payment instrument from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array
    */
-  function alterEventType($value, &$row) {
+  public function alterEventType($value, &$row) {
     return CRM_Event_PseudoConstant::eventType($value);
   }
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
-  function alterEventID($value, &$row) {
+  public function alterEventID($value, &$row) {
     return is_string(CRM_Event_PseudoConstant::event($value, FALSE)) ? CRM_Event_PseudoConstant::event($value, FALSE) : '';
   }
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
-  function alterMembershipTypeID($value, &$row) {
+  public function alterMembershipTypeID($value, &$row) {
     return is_string(CRM_Member_PseudoConstant::membershipType($value, FALSE)) ? CRM_Member_PseudoConstant::membershipType($value, FALSE) : '';
   }
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
-  function alterMembershipStatusID($value, &$row) {
+  public function alterMembershipStatusID($value, &$row) {
     return is_string(CRM_Member_PseudoConstant::membershipStatus($value, FALSE)) ? CRM_Member_PseudoConstant::membershipStatus($value, FALSE) : '';
   }
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param $selectedfield
-   * @param $criteriaFieldName
+   * @param string $criteriaFieldName
    *
    * @return array
    */
-  function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
+  public function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
     $url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
     $row[$selectedfield . '_link'] = $url;
-    $row[$selectedfield . '_hover'] = ts("%1 for this country.", array(1 => $value));
-    $countries =  CRM_Core_PseudoConstant::country($value, FALSE);
-    if(!is_array($countries)){
+    $row[$selectedfield .
+    '_hover'] = ts("%1 for this country.", array(1 => $value));
+    $countries = CRM_Core_PseudoConstant::country($value, FALSE);
+    if (!is_array($countries)) {
       return $countries;
     }
   }
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param $selectedfield
-   * @param $criteriaFieldName
+   * @param string $criteriaFieldName
    *
    * @return array
    */
-  function alterCountyID($value, &$row,$selectedfield, $criteriaFieldName) {
+  public function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
     $url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
     $row[$selectedfield . '_link'] = $url;
-    $row[$selectedfield . '_hover'] = ts("%1 for this county.", array(1 => $value));
+    $row[$selectedfield .
+    '_hover'] = ts("%1 for this county.", array(1 => $value));
     $counties = CRM_Core_PseudoConstant::county($value, FALSE);
-    if(!is_array($counties)){
+    if (!is_array($counties)) {
       return $counties;
     }
   }
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param $selectedfield
-   * @param $criteriaFieldName
+   * @param string $criteriaFieldName
    *
    * @return array
    */
-  function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
+  public function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
     $url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
     $row[$selectedfield . '_link'] = $url;
-    $row[$selectedfield . '_hover'] = ts("%1 for this state.", array(1 => $value));
+    $row[$selectedfield .
+    '_hover'] = ts("%1 for this state.", array(1 => $value));
 
-    $states =  CRM_Core_PseudoConstant::stateProvince($value, FALSE);
-    if(!is_array($states)){
+    $states = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
+    if (!is_array($states)) {
       return $states;
     }
   }
 
   /**
    * @param $value
-   * @param $row
-   * @param $fieldname
+   * @param array $row
+   * @param string $fieldname
    *
    * @return mixed
    */
-  function alterContactID($value, &$row, $fieldname) {
-    $row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $value, $this->_absoluteUrl);
+  public function alterContactID($value, &$row, $fieldname) {
+    $row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view",
+      'reset=1&cid=' . $value, $this->_absoluteUrl);
     return $value;
   }
 
@@ -1391,9 +1377,9 @@ WHERE   line_item_civireport.id IS NOT NULL
    *
    * @return array
    */
-  function alterParticipantStatus($value) {
+  public function alterParticipantStatus($value) {
     if (empty($value)) {
-      return;
+      return NULL;
     }
     return CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label');
   }
@@ -1401,11 +1387,11 @@ WHERE   line_item_civireport.id IS NOT NULL
   /**
    * @param $value
    *
-   * @return string
+   * @return string|void
    */
-  function alterParticipantRole($value) {
+  public function alterParticipantRole($value) {
     if (empty($value)) {
-      return;
+      return NULL;
     }
     $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
     $value = array();
@@ -1420,9 +1406,9 @@ WHERE   line_item_civireport.id IS NOT NULL
    *
    * @return mixed
    */
-  function alterPaymentType($value) {
+  public function alterPaymentType($value) {
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     return $paymentInstruments[$value];
   }
-}
 
+}