From: Brian Shaughnessy Date: Tue, 18 Mar 2014 16:59:43 +0000 (-0400) Subject: CRM-14338-2 fix prefix/suffix on profile view page X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=46796b1991f8d2dcab8539b4865b77f8c278acb0;p=civicrm-core.git CRM-14338-2 fix prefix/suffix on profile view page --- diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 05fd61d48e..b8a54e652c 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -940,7 +940,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { } //handle the case to avoid re-write where the profile field labels are the same - if (CRM_Utils_Array::value($index, $values)) { + if (array_key_exists($index, $values)) { $index .= $nullValueIndex; $nullValueIndex .= $nullValueIndex; } @@ -950,8 +950,8 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { if (isset($details->$name) || $name == 'group' || $name == 'tag') { // to handle gender / suffix / prefix if (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix'))) { - $values[$index] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $details->$name); $params[$index] = $details->$name; + $values[$index] = $details->$name; } elseif (in_array($name, CRM_Contact_BAO_Contact::$_greetingTypes)) { $dname = $name . '_display'; diff --git a/CRM/Profile/Page/Dynamic.php b/CRM/Profile/Page/Dynamic.php index 93131a9b71..7d9b17ccdb 100644 --- a/CRM/Profile/Page/Dynamic.php +++ b/CRM/Profile/Page/Dynamic.php @@ -317,8 +317,16 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page { $profileFields = array(); $labels = array(); + //CRM-14338 + $nullValueIndex = ' '; foreach ($fields as $name => $field) { - $labels[$field['title']] = preg_replace('/\s+|\W+/', '_', $name); + if ( isset($labels[$field['title']]) ) { + $labels[$field['title'].$nullValueIndex] = preg_replace('/\s+|\W+/', '_', $name); + $nullValueIndex .= $nullValueIndex; + } + else { + $labels[$field['title']] = preg_replace('/\s+|\W+/', '_', $name); + } } foreach ($values as $title => $value) {