}
foreach (array('prefix', 'suffix') as $name) {
- $phpName = $name;
$dbName = "{$name}_id";
- $vals = "{$name}es";
$value = $individual->$dbName;
if (in_array($name, $useDBNames)) {
$params[$dbName] = $value;
$contact->$dbName = $value;
if ($value) {
- $temp = $$vals;
- $$phpName = $temp[$value];
+ $$name = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $value);
}
else {
- $$phpName = NULL;
+ $$name = NULL;
}
}
elseif (array_key_exists($dbName, $params)) {
- $temp = $$vals;
// CRM-5278
if (!empty($params[$dbName])) {
- $$phpName = CRM_Utils_Array::value($params[$dbName], $temp);
+ $$name = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $dbName, $params[$dbName]);
}
}
elseif ($value) {
- $temp = $$vals;
- $$phpName = $temp[$value];
+ $$name = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $value);
}
}
}
// Support "unique names" as well as sql names
$fieldKey = $fieldName;
if (empty($fields[$fieldKey])) {
- $fieldKey = $fieldKeys[$fieldName];
+ $fieldKey = CRM_Utils_Array::value($fieldName, $fieldKeys);
}
// If neither worked then this field doesn't exist. Return false.
if (empty($fields[$fieldKey])) {
'civicrm_im', 'civicrm_note', 'civicrm_openid', 'civicrm_phone',
);
- foreach (array(
- 'Individual', 'Organization', 'Household') as $ctype) {
+ foreach (array('Individual', 'Organization', 'Household') as $ctype) {
// take the table.field pairs and their titles from importableFields() if the table is supported
foreach (CRM_Contact_BAO_Contact::importableFields($ctype) as $iField) {
if (isset($iField['where'])) {
$flat = array();
CRM_Utils_Array::flatten($fields, $flat);
+ // FIXME: This may no longer be necessary - check inputs
$replace_these = array(
'individual_prefix' => 'prefix_id',
'individual_suffix' => 'suffix_id',
'gender' => 'gender_id',
);
- //handle for individual_suffix, individual_prefix, gender
- foreach (array(
- 'individual_suffix', 'individual_prefix', 'gender') as $name) {
+ foreach (array('individual_suffix', 'individual_prefix', 'gender') as $name) {
if (CRM_Utils_Array::value($name, $fields)) {
$flat[$replace_these[$name]] = $flat[$name];
unset($flat[$name]);