From 001a515bd258ecf6ad4ead76bd7d2a13bab65ae4 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 14 Dec 2018 10:48:22 +1300 Subject: [PATCH] Fix phone_type_id in export per test --- CRM/Export/BAO/ExportProcessor.php | 8 ++++++-- tests/phpunit/CRM/Export/BAO/ExportTest.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 7b1f8cf3bc..6663265ab8 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -718,6 +718,9 @@ class CRM_Export_BAO_ExportProcessor { return $i18n->crm_translate($fieldValue, $metadata[$field]); } if (!empty($metadata[$field]['pseudoconstant'])) { + if (!empty($metadata[$field]['bao'])) { + return CRM_Core_PseudoConstant::getLabel($metadata[$field]['bao'], $metadata[$field]['name'], $fieldValue); + } // This is not our normal syntax for pseudoconstants but I am a bit loath to // call an external function until sure it is not increasing php processing given this // may be iterated 100,000 times & we already have the $imProvider var loaded. @@ -1147,7 +1150,7 @@ class CRM_Export_BAO_ExportProcessor { * @return string */ protected function getOutputSpecificationIndex($key, $relationshipType, $locationType, $entityLabel) { - if ($locationType || $entityLabel || $key === 'im') { + if ($entityLabel || $key === 'im') { // Just cos that's the history... if ($key !== 'master_id') { $key = $this->getHeaderForRow($key); @@ -1200,8 +1203,9 @@ class CRM_Export_BAO_ExportProcessor { * @return string */ protected function getOutputSpecificationFieldKey($key, $relationshipType, $locationType, $entityLabel) { - if ($relationshipType || $entityLabel || $key === 'im') { + if ($entityLabel || $key === 'im') { if ($key !== 'state_province' && $key !== 'id') { + // @todo - test removing this - indexing by $key should be fine... $key = $this->getHeaderForRow($key); } } diff --git a/tests/phpunit/CRM/Export/BAO/ExportTest.php b/tests/phpunit/CRM/Export/BAO/ExportTest.php index ef7af5c03e..626af0a40b 100644 --- a/tests/phpunit/CRM/Export/BAO/ExportTest.php +++ b/tests/phpunit/CRM/Export/BAO/ExportTest.php @@ -833,14 +833,14 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase { 'contact_id' => $contactID, 'location_type_id' => 'Billing', 'phone_type_id' => 'Mobile', - 'phone' => 'Billing' . 'Mobile' . $contactID, + 'phone' => 'Billing' . 'Mobile' . $contactID, 'is_primary' => 1, ]); $this->callAPISuccess('Phone', 'create', [ 'contact_id' => $contactID, 'location_type_id' => 'Home', 'phone_type_id' => 'Phone', - 'phone' => 'Home' . 'Phone' . $contactID, + 'phone' => 'Home' . 'Phone' . $contactID, ]); } -- 2.25.1