Fix: Missing name

This commit is contained in:
Laurent Destailleur 2012-01-29 23:24:47 +01:00
parent cb37a8475a
commit f3a966a313
20 changed files with 61 additions and 55 deletions

View File

@ -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

View File

@ -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++;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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>';

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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>';

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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";

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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'].= ', ';

View File

@ -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 ', ';

View File

@ -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);