From 94d313840f4ef1d0944e8b7efbec5d18c84783a2 Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 21 Aug 2018 15:16:26 +0530 Subject: [PATCH] CRM-21677 - report clean up --- CRM/Report/Form/Contact/CurrentEmployer.php | 17 +---------------- CRM/Report/Form/Contact/Detail.php | 7 +------ CRM/Report/Form/Contact/Relationship.php | 18 +----------------- 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index 67466c8cb6..8c86c2b9a0 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -360,7 +360,7 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} // Handle ID to label conversion for contact fields $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, 'contact/currentEmployer', 'View Contact Detail') ? TRUE : $entryFound; - + $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound; // display birthday in the configured custom format if (array_key_exists('civicrm_contact_birth_date', $row)) { $birthDate = $row['civicrm_contact_birth_date']; @@ -383,21 +383,6 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} $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; - } - - 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, FALSE); - } - $entryFound = TRUE; - } - // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php index 238bffa09b..7658ca71ff 100644 --- a/CRM/Report/Form/Contact/Detail.php +++ b/CRM/Report/Form/Contact/Detail.php @@ -840,12 +840,7 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { $entryFound = TRUE; } - 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, FALSE); - } - $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 diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 0e34078cdf..7b97591206 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -720,23 +720,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { $entryFound = TRUE; } - // Handle country - // @todo use alterDisplayAddressFields function - 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; - } - - // Handle state/province - // @todo use alterDisplayAddressFields function - 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, FALSE); - } - $entryFound = TRUE; - } + $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound; // Handle contact name A // @todo refactor into separate function -- 2.25.1