X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FIndividual.php;h=245b59059ed43859366f33c9b1325d7178b6710e;hb=b8416fbb0b2292d8b1390b970816415251d6a256;hp=490b1645a84fdcbdcf8e5cfe885536ec72555cfd;hpb=0c07fff8870aebc78542d5519ba7c4e4689c53cf;p=civicrm-core.git diff --git a/CRM/Contact/BAO/Individual.php b/CRM/Contact/BAO/Individual.php index 490b1645a8..245b59059e 100644 --- a/CRM/Contact/BAO/Individual.php +++ b/CRM/Contact/BAO/Individual.php @@ -49,7 +49,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { * * @param array $params * (reference ) an assoc array of name/value pairs. - * @param array $contact + * @param CRM $contact * Contact object. * * @return CRM_Contact_BAO_Contact @@ -254,7 +254,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { } //now set the names. - $names = array('sortName' => 'sort_name', 'displayName' => 'display_name'); + $names = array('displayName' => 'display_name', 'sortName' => 'sort_name'); foreach ($names as $value => $name) { if (empty($$value)) { if ($email) { @@ -263,6 +263,13 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { elseif ($uniqId) { $$value = $uniqId; } + elseif (!empty($params[$name])) { + $$value = $params[$name]; + } + // If we have nothing else going on set sort_name to display_name. + elseif ($displayName) { + $$value = $displayName; + } } //finally if we could not pass anything lets keep db. if (!empty($$value)) { @@ -408,11 +415,10 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact { * Check if there is data to create the object. * * @param array $params - * (reference ) an assoc array of name/value pairs. * * @return bool */ - public static function dataExists(&$params) { + public static function dataExists($params) { if ($params['contact_type'] == 'Individual') { return TRUE; }