CRM-21677 - report clean up for contribution reports
authoryashodha <yashodha@cividesk.com>
Tue, 10 Sep 2019 11:15:59 +0000 (16:45 +0530)
committeryashodha <yashodha@cividesk.com>
Tue, 10 Sep 2019 11:15:59 +0000 (16:45 +0530)
CRM/Report/Form/Contribute/History.php
CRM/Report/Form/Contribute/SoftCredit.php
CRM/Report/Form/Contribute/TopDonor.php

index 2e8c9be10c2ed169590134243ad58689c6e85458..a46611a55427fc955a4a74cf3b038a4c7f206752 100644 (file)
@@ -810,15 +810,6 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
 
     $last_primary = NULL;
     foreach ($rows as $rowNum => $row) {
-      //handle gender
-      if (array_key_exists('civicrm_contact_gender_id', $row)) {
-        if ($value = $row['civicrm_contact_gender_id']) {
-          $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
-          $row['civicrm_contact_gender_id'] = $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value];
-        }
-        $entryFound = TRUE;
-      }
-
       // Highlight primary contact and amount row
       if (is_numeric($rowNum) ||
         ($last_primary && ($rowNum == "{$last_primary}_total"))
@@ -860,15 +851,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
         $entryFound = TRUE;
       }
 
-      // display birthday in the configured custom format
-      if (array_key_exists('civicrm_contact_birth_date', $row)) {
-        $birthDate = $row['civicrm_contact_birth_date'];
-        if ($birthDate) {
-          $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d');
-        }
-        $entryFound = TRUE;
-      }
-
+      $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;
       $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;
 
     }
index 31d50193cdae5efa6e1f73c7fc3ca326c4a738b0..3f8fdd54f0cac749b56e8d63c7f3d3087c88905c 100644 (file)
@@ -613,29 +613,13 @@ GROUP BY   {$this->_aliases['civicrm_contribution']}.currency
         );
       }
 
-      //handle gender
-      if (array_key_exists('civicrm_contact_gender_id', $row)) {
-        if ($value = $row['civicrm_contact_gender_id']) {
-          $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
-          $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value];
-        }
-        $entryFound = TRUE;
-      }
-
-      // display birthday in the configured custom format
-      if (array_key_exists('civicrm_contact_birth_date', $row)) {
-        $birthDate = $row['civicrm_contact_birth_date'];
-        if ($birthDate) {
-          $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d');
-        }
-        $entryFound = TRUE;
-      }
-
       if (!empty($row['civicrm_financial_trxn_card_type_id']) && !in_array('Subtotal', $rows[$rowNum])) {
         $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
+      $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;
+
       // skip looking further in rows, if first row itself doesn't
       // have the column we need
       if (!$entryFound) {
index 9b613bef3cdb66caf9342b039018c478db8c93ff..b6479c14aa9e04773a5dc9e47196160672a6a7ff 100644 (file)
@@ -410,29 +410,13 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
         }
         $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s)') ? TRUE : $entryFound;
 
-        //handle gender
-        if (array_key_exists('civicrm_contact_gender_id', $row)) {
-          if ($value = $row['civicrm_contact_gender_id']) {
-            $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
-            $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value];
-          }
-          $entryFound = TRUE;
-        }
-
-        // display birthday in the configured custom format
-        if (array_key_exists('civicrm_contact_birth_date', $row)) {
-          $birthDate = $row['civicrm_contact_birth_date'];
-          if ($birthDate) {
-            $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d');
-          }
-          $entryFound = TRUE;
-        }
-
         if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
           $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
           $entryFound = TRUE;
         }
 
+        $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;
+
         // skip looking further in rows, if first row itself doesn't
         // have the column we need
         if (!$entryFound) {