From adb0a0f49197841fcc7135709cb122fdcd2ec2aa Mon Sep 17 00:00:00 2001 From: kurund Date: Tue, 15 Apr 2014 19:11:40 -0700 Subject: [PATCH] code clean / fixes CRM-14429 ---------------------------------------- * CRM-14429: Contact import fails silently on lookup of custom field option values by label https://issues.civicrm.org/jira/browse/CRM-14429 --- CRM/Contact/Import/Parser/Contact.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 60ea53b99f..2ac24f27cd 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1953,6 +1953,22 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $extends = CRM_Utils_Array::value('extends', $customFields[$customFieldID]); $htmlType = CRM_Utils_Array::value( 'html_type', $customFields[$customFieldID] ); switch ( $htmlType ) { + case 'Select': + case 'Radio': + case 'Autocomplete-Select': + if ($customFields[$customFieldID]['data_type'] == 'String') { + $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); + foreach ($customOption as $customFldID => $customValue) { + $val = CRM_Utils_Array::value('value', $customValue); + $label = CRM_Utils_Array::value('label', $customValue); + $label = strtolower($label); + $value = strtolower(trim($formatted[$key])); + if (($value == $label) || ($value == strtolower($val))) { + $params[$key] = $formatted[$key] = $val; + } + } + } + break; case 'CheckBox': case 'AdvMulti-Select': case 'Multi-Select': -- 2.25.1