From a294296d14395bb6bc1ac6099e50fd3fa187456d Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 6 Oct 2013 22:39:24 +0100 Subject: [PATCH] CRM-13344 - Contact Import - Fix prefix, suffix, gender import ---------------------------------------- * CRM-13344: Resolve test / schema issues around prefix_id, suffix_id, gender http://issues.civicrm.org/jira/browse/CRM-13344 --- CRM/Contact/Import/Parser/Contact.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index f6d063ddca..6852c3d35e 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -665,21 +665,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { if ($createNewContact) { //CRM-4430, don't carry if not submitted. - foreach (array( - 'prefix', - 'suffix', - 'gender', - ) as $name) { - if (array_key_exists($name, $formatted)) { - if (in_array($name, array( - 'prefix', - 'suffix', - ))) { - $formattedName = "individual_{$name}"; - $formatted[$formattedName] = CRM_Core_OptionGroup::getValue($formattedName, (string) $formatted[$name]); - } - else { - $formatted[$name] = CRM_Core_OptionGroup::getValue($name, (string) $formatted[$name]); + foreach (array('prefix_id', 'suffix_id', 'gender_id') as $name) { + if (!empty($formatted[$name])) { + $options = CRM_Contact_BAO_Contact::buildOptions($name, 'get'); + if (!isset($options[$formatted[$name]])) { + $formatted[$name] = CRM_Utils_Array::key((string) $formatted[$name], $options); } } } -- 2.25.1