From f3a966a313424f7a3b922fe2159d355efa708860 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2012 23:24:47 +0100 Subject: [PATCH] Fix: Missing name --- htdocs/bookmarks/liste.php | 2 +- htdocs/comm/multiprix.php | 2 +- htdocs/comm/propal/contact.php | 6 +++--- htdocs/commande/contact.php | 6 +++--- htdocs/compta/facture/contact.php | 6 +++--- htdocs/compta/index.php | 4 ++-- htdocs/contact/class/contact.class.php | 15 +++++++++------ htdocs/contrat/contact.php | 6 +++--- htdocs/core/class/html.formactions.class.php | 8 ++++---- htdocs/ecm/index.php | 2 +- htdocs/fichinter/contact.php | 6 +++--- htdocs/fourn/commande/contact.php | 8 ++++---- htdocs/fourn/commande/index.php | 4 ++-- htdocs/fourn/facture/contact.php | 6 +++--- htdocs/product/stock/mouvement.php | 2 +- htdocs/projet/contact.php | 8 ++++---- htdocs/projet/tasks/contact.php | 6 +++--- .../societe/canvas/actions_card_common.class.php | 4 ++-- htdocs/societe/soc.php | 4 ++-- htdocs/user/class/user.class.php | 11 +++++++---- 20 files changed, 61 insertions(+), 55 deletions(-) diff --git a/htdocs/bookmarks/liste.php b/htdocs/bookmarks/liste.php index cb05a23c77e24..a9664d8dc861a 100644 --- a/htdocs/bookmarks/liste.php +++ b/htdocs/bookmarks/liste.php @@ -154,7 +154,7 @@ if ($obj->fk_user) { $userstatic->id=$obj->fk_user; - $userstatic->nom=$obj->login; + $userstatic->lastname=$obj->login; print $userstatic->getNomUrl(1); } else diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 3d9ed3de3b696..790c4a8a1ee4c 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -152,7 +152,7 @@ print ''.dol_print_date($db->jdate($obj->dc),"dayhour").''; print ''.$obj->price_level.' '; $userstatic->id=$obj->uid; - $userstatic->nom=$obj->login; + $userstatic->lastname=$obj->login; print ''.$userstatic->getNomUrl(1).''; print ''; $i++; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index b6fe67d41225a..74d3de71b3988 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -322,14 +322,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 94dee98896b68..966e2c660fc26 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -313,14 +313,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 1787baa22084b..410cfcff75ebe 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -308,14 +308,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 4166a4ab1306c..948dd09b63899 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -604,8 +604,8 @@ $deplacementstatic->ref=$objp->rowid; $deplacementstatic->id=$objp->rowid; $userstatic->id=$objp->uid; - $userstatic->nom=$objp->name; - $userstatic->prenom=$objp->firstname; + $userstatic->lastname=$objp->name; + $userstatic->firstname=$objp->firstname; print ''; print ''.$deplacementstatic->getNomUrl(1).''; print ''.$userstatic->getNomUrl(1).''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d3c8781aa7d40..afc935fb65ffa 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -913,6 +913,9 @@ function getFullName($langs,$option=0,$nameorder=-1) { global $conf; + if (empty($this->lastname)) $this->lastname=($this->name?$this->name:$this->nom); + if (empty($this->firstname)) $this->firstname=($this->firstname?$this->firstname:$this->prenom); + $ret=''; if ($option && $this->civilite_id) { @@ -925,15 +928,15 @@ function getFullName($langs,$option=0,$nameorder=-1) if ($nameorder) { - if ($this->firstname) $ret.=$this->firstname; - if ($this->firstname && $this->name) $ret.=' '; - if ($this->name) $ret.=$this->name; + $ret.=$this->firstname; + if ($this->firstname && $this->lastname) $ret.=' '; + $ret.=$this->lastname; } else { - if ($this->name) $ret.=$this->name; - if ($this->firstname && $this->name) $ret.=' '; - if ($this->firstname) $ret.=$this->firstname; + $ret.=$this->lastname; + if ($this->firstname && $this->lastname) $ret.=' '; + $ret.=$this->firstname; } return trim($ret); } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index cee7fd4535318..df9f6cc612617 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -308,14 +308,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 2fcf24429569d..207f29b74e4c4 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -101,7 +101,7 @@ function form_select_status_action($formname,$selected,$canedit=1,$htmlname='com /** * Show list of actions for element - * + * * @param Object $object Object * @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter' * @param int $socid socid of user @@ -146,8 +146,8 @@ function showactions($object,$typeelement,$socid=0) print ''.dol_trunc($action->label,32).''; $userstatic = new User($this->db); $userstatic->id = $action->author->id; - $userstatic->prenom = $action->author->firstname; - $userstatic->nom = $action->author->lastname; + $userstatic->firstname = $action->author->firstname; + $userstatic->lastname = $action->author->lastname; print ''.$userstatic->getNomUrl(1).''; print ''; } @@ -160,7 +160,7 @@ function showactions($object,$typeelement,$socid=0) /** * Output list of type of event - * + * * @param string $selected Type pre-selectionne * @param string $htmlname Nom champ formulaire * @return void diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 7547616ca46e7..4ab066e0dc842 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -739,7 +739,7 @@ // Info print ''; $userstatic->id=$val['fk_user_c']; - $userstatic->nom=$val['login_c']; + $userstatic->lastname=$val['login_c']; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMSectionManual").'
'; $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).'
'; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 34a3a03068ee7..467e8683527ba 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -298,14 +298,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 5a80d98ec7dd5..10fd92f18c46b 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref)) { $langs->trans("OrderCard"); - + if ($object->fetch($id, $ref) > 0) { $soc = new Societe($db); @@ -303,14 +303,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 293779687988e..095f627a8d3e7 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -223,8 +223,8 @@ print ""; print ''; $userstatic->id=$obj->rowid; - $userstatic->nom=$obj->name; - $userstatic->prenom=$obj->firstname; + $userstatic->lastname=$obj->name; + $userstatic->firstname=$obj->firstname; print $userstatic->getNomUrl(1); print ''; print "\n"; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 2b5ccbf7cc34a..c10bf7bca87a8 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -299,14 +299,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1de22cd3e2c26..5f72c6f8413bb 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -321,7 +321,7 @@ // Author print ''; $userstatic->id=$objp->fk_user_author; - $userstatic->nom=$objp->login; + $userstatic->lastname=$objp->login; print $userstatic->getNomUrl(1); print "\n"; // Value diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 24e4a7ab3b58a..9409a9dc99714 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -245,7 +245,7 @@ print ''; $var=!$var; - print ""; + print ""; print ''; print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); @@ -327,14 +327,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['nom']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['nom']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index e800599a70ecb..26934f1c7674a 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -328,14 +328,14 @@ if ($tab[$i]['source']=='internal') { $userstatic->id=$tab[$i]['id']; - $userstatic->nom=$tab[$i]['nom']; - $userstatic->prenom=$tab[$i]['firstname']; + $userstatic->lastname=$tab[$i]['lastname']; + $userstatic->firstname=$tab[$i]['firstname']; print $userstatic->getNomUrl(1); } if ($tab[$i]['source']=='external') { $contactstatic->id=$tab[$i]['id']; - $contactstatic->name=$tab[$i]['nom']; + $contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->firstname=$tab[$i]['firstname']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index be165ef3b2481..ff0696f237b7d 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -603,8 +603,8 @@ function assign_values(&$action, $id=0, $ref='') foreach($listsalesrepresentatives as $val) { $userstatic->id=$val['id']; - $userstatic->nom=$val['name']; - $userstatic->prenom=$val['firstname']; + $userstatic->lastname=$val['name']; + $userstatic->firstname=$val['firstname']; $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 14fecace66ecc..6060fc0f06aa2 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1802,8 +1802,8 @@ foreach($listsalesrepresentatives as $val) { $userstatic->id=$val['id']; - $userstatic->nom=$val['name']; - $userstatic->prenom=$val['firstname']; + $userstatic->lastname=$val['name']; + $userstatic->firstname=$val['firstname']; print $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) print ', '; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4cd8677cc7449..d4de350a886dc 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1717,6 +1717,9 @@ function getFullName($langs,$option=0,$nameorder=-1) { global $conf; + if (empty($this->lastname)) $this->lastname=($this->name?$this->name:$this->nom); + if (empty($this->firstname)) $this->firstname=($this->firstname?$this->firstname:$this->prenom); + $ret=''; if ($option && $this->civilite_id) { @@ -1729,15 +1732,15 @@ function getFullName($langs,$option=0,$nameorder=-1) if ($nameorder) { - if ($this->firstname) $ret.=$this->firstname; + $ret.=$this->firstname; if ($this->firstname && $this->lastname) $ret.=' '; - if ($this->lastname) $ret.=$this->lastname; + $ret.=$this->lastname; } else { - if ($this->lastname) $ret.=$this->lastname; + $ret.=$this->lastname; if ($this->firstname && $this->lastname) $ret.=' '; - if ($this->firstname) $ret.=$this->firstname; + $ret.=$this->firstname; } return trim($ret);