From 96d30001860e862ca6e9e3419bb40b68110f9c95 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 11 Oct 2018 10:26:03 +0530 Subject: [PATCH] CRM-21677 - more report clean up --- CRM/Report/Form/Campaign/SurveyDetails.php | 18 ++---------------- CRM/Report/Form/Pledge/Pbnp.php | 17 +---------------- CRM/Report/Form/Walklist/Walklist.php | 18 ++---------------- 3 files changed, 5 insertions(+), 48 deletions(-) diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 52dcba9848..ddd7bfff50 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -469,22 +469,6 @@ INNER JOIN civicrm_option_value val ON ( val.option_group_id = survey.result_id $entryFound = FALSE; foreach ($rows as $rowNum => $row) { - // handle state province - if (array_key_exists('civicrm_address_state_province_id', $row)) { - if ($value = $row['civicrm_address_state_province_id']) { - $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value); - } - $entryFound = TRUE; - } - - // handle country - if (array_key_exists('civicrm_address_country_id', $row)) { - if ($value = $row['civicrm_address_country_id']) { - $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value); - } - $entryFound = TRUE; - } - // convert display name to links if (array_key_exists('civicrm_contact_sort_name', $row) && array_key_exists('civicrm_contact_id', $row) @@ -512,6 +496,8 @@ INNER JOIN civicrm_option_value val ON ( val.option_group_id = survey.result_id $entryFound = TRUE; } + $entryFound = $this->alterDisplayAddressFields($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) { diff --git a/CRM/Report/Form/Pledge/Pbnp.php b/CRM/Report/Form/Pledge/Pbnp.php index d0d20efec4..a0b0d7e827 100644 --- a/CRM/Report/Form/Pledge/Pbnp.php +++ b/CRM/Report/Form/Pledge/Pbnp.php @@ -342,22 +342,6 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form { $entryFound = TRUE; } - // handle state province - if (array_key_exists('civicrm_address_state_province_id', $row)) { - if ($value = $row['civicrm_address_state_province_id']) { - $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($value, FALSE); - } - $entryFound = TRUE; - } - - // handle country - if (array_key_exists('civicrm_address_country_id', $row)) { - if ($value = $row['civicrm_address_country_id']) { - $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE); - } - $entryFound = TRUE; - } - // convert display name to links if (array_key_exists('civicrm_contact_sort_name', $row) && array_key_exists('civicrm_contact_id', $row) @@ -380,6 +364,7 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form { $entryFound = TRUE; } + $entryFound = $this->alterDisplayAddressFields($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) { diff --git a/CRM/Report/Form/Walklist/Walklist.php b/CRM/Report/Form/Walklist/Walklist.php index 5727e3b5ec..0ca16f6886 100644 --- a/CRM/Report/Form/Walklist/Walklist.php +++ b/CRM/Report/Form/Walklist/Walklist.php @@ -190,22 +190,6 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom public function alterDisplay(&$rows) { $entryFound = FALSE; foreach ($rows as $rowNum => $row) { - // handle state province - if (array_key_exists('civicrm_address_state_province_id', $row)) { - if ($value = $row['civicrm_address_state_province_id']) { - $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value); - } - $entryFound = TRUE; - } - - // handle country - if (array_key_exists('civicrm_address_country_id', $row)) { - if ($value = $row['civicrm_address_country_id']) { - $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value); - } - $entryFound = TRUE; - } - // convert display name to links if (array_key_exists('civicrm_contact_sort_name', $row) && array_key_exists('civicrm_contact_id', $row) @@ -218,6 +202,8 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom $entryFound = TRUE; } + $entryFound = $this->alterDisplayAddressFields($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) { -- 2.25.1