Merge pull request #4925 from KarinG/patch-1
[civicrm-core.git] / CRM / Report / Form / Contribute / Detail.php
index 4936df85eaaab4e736dd185cd6216bd679afc070..42b37694d75fc9c08f99622dd34f070fe18f71e3 100644 (file)
@@ -45,12 +45,10 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
   protected $_customGroupExtends = array('Contribution');
 
   /**
-   *
    */
   /**
-   *
    */
-  function __construct() {
+  public function __construct() {
 
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
@@ -101,7 +99,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
               'title' => ts('Last Name, First Name'),
               'default' => '1',
               'default_weight' => '0',
-              'default_order' => 'ASC'
+              'default_order' => 'ASC',
             ),
           ),
           'grouping' => 'contact-fields',
@@ -174,15 +172,15 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
             'net_amount' => NULL,
             'contribution_or_soft' => array(
               'title' => ts('Contribution OR Soft Credit?'),
-              'dbAlias' => "'Contribution'"
+              'dbAlias' => "'Contribution'",
             ),
             'soft_credits' => array(
               'title' => ts('Soft Credits'),
-              'dbAlias' => "NULL"
+              'dbAlias' => "NULL",
             ),
             'soft_credit_for' => array(
               'title' => ts('Soft Credit For'),
-              'dbAlias' => "NULL"
+              'dbAlias' => "NULL",
             ),
           ),
           'filters' => array(
@@ -333,11 +331,11 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
     parent::__construct();
   }
 
-  function preProcess() {
+  public function preProcess() {
     parent::preProcess();
   }
 
-  function select() {
+  public function select() {
     $this->_columnHeaders = array();
 
     parent::select();
@@ -346,7 +344,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
     $this->_select = str_replace("sum({$this->_aliases['civicrm_contribution']}.total_amount)", "{$this->_aliases['civicrm_contribution']}.total_amount", $this->_select);
   }
 
-  function orderBy() {
+  public function orderBy() {
     parent::orderBy();
 
     // please note this will just add the order-by columns to select query, and not display in column-headers.
@@ -363,7 +361,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
   /**
    * @param bool $softcredit
    */
-  function from($softcredit = FALSE) {
+  public function from($softcredit = FALSE) {
     $this->_from = "
         FROM  civicrm_contact      {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
               INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
@@ -444,7 +442,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
 
   }
 
-  function groupBy() {
+  public function groupBy() {
     $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_contribution']}.id ";
   }
 
@@ -453,7 +451,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
    *
    * @return array
    */
-  function statistics(&$rows) {
+  public function statistics(&$rows) {
     $statistics = parent::statistics($rows);
 
     $totalAmount = $average = array();
@@ -534,7 +532,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency";
     return $statistics;
   }
 
-  function postProcess() {
+  public function postProcess() {
     // get the acl clauses built before we assemble the query
     $this->buildACLClause($this->_aliases['civicrm_contact']);
 
@@ -593,7 +591,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency";
     ) {
       $tempQuery = "(SELECT * FROM civireport_contribution_detail_temp1)";
     }
-    else if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+    elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
       'soft_credits_only'
     ) {
       $tempQuery = "(SELECT * FROM civireport_contribution_detail_temp2)";
@@ -618,8 +616,7 @@ UNION ALL
         list($alias, $rest) = explode('.', $clause);
         $orderClause[] = $aliases[$alias] . "_" . $rest;
       }
-      $orderBy = (!empty($orderClause)) ?
-        "ORDER BY " . implode(', ', $orderClause) : '';
+      $orderBy = (!empty($orderClause)) ? "ORDER BY " . implode(', ', $orderClause) : '';
     }
 
     // 6. show result set from temp table 3
@@ -640,7 +637,7 @@ UNION ALL
   /**
    * @param $rows
    */
-  function alterDisplay(&$rows) {
+  public function alterDisplay(&$rows) {
     // custom code to alter rows
     $checkList = array();
     $entryFound = FALSE;
@@ -809,7 +806,7 @@ WHERE  civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu
     }
   }
 
-  function sectionTotals() {
+  public function sectionTotals() {
 
     // Reports using order_bys with sections must populate $this->_selectAliases in select() method.
     if (empty($this->_selectAliases)) {
@@ -874,11 +871,9 @@ WHERE  civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu
           }
           else {
             // other aliases are higher level; roll count into their total
-            $totals[$key] = (array_key_exists($key, $totals)) ?
-              $totals[$key] + $dao->ct : $dao->ct;
+            $totals[$key] = (array_key_exists($key, $totals)) ? $totals[$key] + $dao->ct : $dao->ct;
             if ($showsumcontribs) {
-              $sumcontribs[$key] = array_key_exists($key, $sumcontribs) ?
-                $sumcontribs[$key] + $dao->sumcontribs : $dao->sumcontribs;
+              $sumcontribs[$key] = array_key_exists($key, $sumcontribs) ? $sumcontribs[$key] + $dao->sumcontribs : $dao->sumcontribs;
             }
           }
         }
@@ -893,7 +888,7 @@ WHERE  civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu
         ) {
           $title = '%1 contributions: %2';
         }
-        else if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+        elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
           'soft_credits_only'
         ) {
           $title = '%1 soft-credits: %2';
@@ -901,7 +896,7 @@ WHERE  civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu
         foreach ($totals as $key => $total) {
           $totalandsum[$key] = ts($title, array(
             1 => $total,
-            2 => CRM_Utils_Money::format($sumcontribs[$key])
+            2 => CRM_Utils_Money::format($sumcontribs[$key]),
           ));
         }
         $this->assign('sectionTotals', $totalandsum);
@@ -912,4 +907,3 @@ WHERE  civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu
     }
   }
 }
-