CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Trying to troubleshoot how display_name, sort_name get created
Pages: [1]

Author Topic: Trying to troubleshoot how display_name, sort_name get created  (Read 539 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Trying to troubleshoot how display_name, sort_name get created
August 21, 2014, 05:25:29 am
Whenever I edit an individual contact (either inline or full screen), the display_name and the sort_name fields get set to be the contact's email address.   I already checked the configuration at "Administer ... Customize Data and Screens ... Display Preferences". 

The setting for "Individual Display Name Format" is "{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}"

The setting for "Individual Sort Name Format" is "{contact.last_name}{, }{contact.first_name}"

What else should I check? Any ideas on how to solve this?  Where in the code should I start debugging?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Trying to troubleshoot how display_name, sort_name get created
August 21, 2014, 12:40:08 pm
i have a vague memory of this but can't find any notes about it in our system.

have you tried clearing out templates_c

also upgrading to latest?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Trying to troubleshoot how display_name, sort_name get created
August 21, 2014, 12:54:51 pm
ah - my notes were in here that is why - the problem for us arose after a migration from a legacy system so may not relate to your situation at all.

but there are some sql queries that we used to sort this posted here http://forum.civicrm.org/index.php/topic,14516.msg68829.html
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Trying to troubleshoot how display_name, sort_name get created
August 21, 2014, 02:31:19 pm
Peter - Thanks for the tips. I already upgraded to the latest version ( 4.4.6) and cleared out the "templates_c" folder.  I also cleared the CiviCRM cache.   I can also run an SQL UPDATE statement to update the problem records.

However, whenever an end-user creates a new contact or edits an existing contact then the display_name and sort_name get trashed. ( ie set to email, or if there is no email then display_name & sort_name get set to null/blanks
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Trying to troubleshoot how display_name, sort_name get created
August 21, 2014, 04:09:23 pm
I have a temporary solution.

In the file /CRM/Contact/BAO/Individual.php (around 210 -215)
I replaced the line:
Code: [Select]
$displayName = CRM_Utils_Address::format($formatted, $format,  FALSE, FALSE, TRUE, $tokenFields );
New line:
Code: [Select]
$displayName = $firstName." ".$lastName;
Did similar replacement for the $sortName variable.

What I am noticing during debugging: The return value from "CRM_Utils_Address::format" is returning an empty string for the display name and the sort name. Those empty strings cause the calling function to use email address instead.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Trying to troubleshoot how display_name, sort_name get created

This forum was archived on 2017-11-26.