From f3a966a313424f7a3b922fe2159d355efa708860 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> 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 cb05a23c77e..a9664d8dc86 100644 --- a/htdocs/bookmarks/liste.php +++ b/htdocs/bookmarks/liste.php @@ -154,7 +154,7 @@ if ($resql) 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 3d9ed3de3b6..790c4a8a1ee 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -152,7 +152,7 @@ if ($_socid > 0) print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>'; print '<td>'.$obj->price_level.' </td>'; $userstatic->id=$obj->uid; - $userstatic->nom=$obj->login; + $userstatic->lastname=$obj->login; print '<td align="right">'.$userstatic->getNomUrl(1).'</td>'; print '</tr>'; $i++; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index b6fe67d4122..74d3de71b39 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -322,14 +322,14 @@ if ($id > 0 || ! empty($ref)) 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 94dee98896b..966e2c660fc 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -313,14 +313,14 @@ if ($id > 0 || ! empty($ref)) 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 1787baa2208..410cfcff75e 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -308,14 +308,14 @@ if ($id > 0 || ! empty($ref)) 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 4166a4ab130..948dd09b638 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -604,8 +604,8 @@ if ($conf->deplacement->enabled && $user->rights->deplacement->lire) $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 '<tr '.$bc[$var].'>'; print '<td>'.$deplacementstatic->getNomUrl(1).'</td>'; print '<td>'.$userstatic->getNomUrl(1).'</td>'; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d3c8781aa7d..afc935fb65f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -913,6 +913,9 @@ class Contact extends CommonObject { 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 @@ class Contact extends CommonObject 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 cee7fd45353..df9f6cc6126 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -308,14 +308,14 @@ if ($id > 0) 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 2fcf2442956..207f29b74e4 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -101,7 +101,7 @@ class FormActions /** * 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 @@ class FormActions print '<td title="'.dol_escape_htmltag($action->label).'">'.dol_trunc($action->label,32).'</td>'; $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 '<td>'.$userstatic->getNomUrl(1).'</td>'; print '</tr>'; } @@ -160,7 +160,7 @@ class FormActions /** * 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 7547616ca46..4ab066e0dc8 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -739,7 +739,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti // Info print '<td align="center">'; $userstatic->id=$val['fk_user_c']; - $userstatic->nom=$val['login_c']; + $userstatic->lastname=$val['login_c']; $htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>'; $htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>'; $htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1).'<br>'; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 34a3a03068e..467e8683527 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -298,14 +298,14 @@ if ($id > 0) 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 5a80d98ec7d..10fd92f18c4 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -130,7 +130,7 @@ dol_htmloutput_mesg($mesg); if ($id > 0 || ! empty($ref)) { $langs->trans("OrderCard"); - + if ($object->fetch($id, $ref) > 0) { $soc = new Societe($db); @@ -303,14 +303,14 @@ if ($id > 0 || ! empty($ref)) 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 29377968798..095f627a8d3 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -223,8 +223,8 @@ if ($resql) print "<tr $bc[$var]>"; print '<td>'; $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 '</td>'; print "</tr>\n"; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 2b5ccbf7cc3..c10bf7bca87 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -299,14 +299,14 @@ if ($id > 0) 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 1de22cd3e2c..5f72c6f8413 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -321,7 +321,7 @@ if ($resql) // Author print '<td>'; $userstatic->id=$objp->fk_user_author; - $userstatic->nom=$objp->login; + $userstatic->lastname=$objp->login; print $userstatic->getNomUrl(1); print "</td>\n"; // Value diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 24e4a7ab3b5..9409a9dc997 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -245,7 +245,7 @@ if ($id > 0 || ! empty($ref)) print '<input type="hidden" name="id" value="'.$id.'">'; $var=!$var; - print "<tr $bc[$var]>"; + print "<tr ".$bc[$var].">"; print '<td nowrap="nowrap">'; print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); @@ -327,14 +327,14 @@ if ($id > 0 || ! empty($ref)) 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 e800599a70e..26934f1c767 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -328,14 +328,14 @@ if ($id > 0 || ! empty($ref)) 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 be165ef3b24..ff0696f237b 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -603,8 +603,8 @@ abstract class ActionsCardCommon 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 14fecace66e..6060fc0f06a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1802,8 +1802,8 @@ else 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 4cd8677cc74..d4de350a886 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1717,6 +1717,9 @@ class User extends CommonObject { 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 @@ class User extends CommonObject 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); -- GitLab