Fix in select of user when firstname and lastname is empty
This commit is contained in:
parent
6536208a14
commit
29f0a9b784
@ -1726,6 +1726,7 @@ class Form
|
|||||||
$fullNameMode = 1; //Firstname+lastname
|
$fullNameMode = 1; //Firstname+lastname
|
||||||
}
|
}
|
||||||
$labeltoshow .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
|
$labeltoshow .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
|
||||||
|
if (empty($obj->firstname) && empty($obj->lastname)) $labeltoshow .= $obj->login;
|
||||||
|
|
||||||
// Complete name with more info
|
// Complete name with more info
|
||||||
$moreinfo = '';
|
$moreinfo = '';
|
||||||
|
|||||||
@ -430,7 +430,7 @@ class FormOther
|
|||||||
if ($showempty) $out .= '<option value="0"> </option>';
|
if ($showempty) $out .= '<option value="0"> </option>';
|
||||||
|
|
||||||
// Get list of users allowed to be viewed
|
// Get list of users allowed to be viewed
|
||||||
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
|
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut as status, u.login, u.photo, u.gender, u.entity, u.admin";
|
||||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
|
|
||||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||||
@ -455,7 +455,7 @@ class FormOther
|
|||||||
if (empty($user->rights->user->user->lire) && $user->socid)
|
if (empty($user->rights->user->user->lire) && $user->socid)
|
||||||
{
|
{
|
||||||
$sql_usr .= " UNION ";
|
$sql_usr .= " UNION ";
|
||||||
$sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
|
$sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut as status, u2.login, u2.photo, u2.gender, u2.entity, u2.admin";
|
||||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
|
||||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||||
@ -480,14 +480,37 @@ class FormOther
|
|||||||
$resql_usr = $this->db->query($sql_usr);
|
$resql_usr = $this->db->query($sql_usr);
|
||||||
if ($resql_usr)
|
if ($resql_usr)
|
||||||
{
|
{
|
||||||
|
$userstatic = new User($this->db);
|
||||||
|
$showstatus = 1;
|
||||||
|
|
||||||
while ($obj_usr = $this->db->fetch_object($resql_usr))
|
while ($obj_usr = $this->db->fetch_object($resql_usr))
|
||||||
{
|
{
|
||||||
|
$userstatic->id = $obj_usr->rowid;
|
||||||
|
$userstatic->lastname = $obj_usr->lastname;
|
||||||
|
$userstatic->firstname = $obj_usr->firstname;
|
||||||
|
$userstatic->photo = $obj_usr->photo;
|
||||||
|
$userstatic->statut = $obj_usr->status;
|
||||||
|
$userstatic->entity = $obj_usr->entity;
|
||||||
|
$userstatic->admin = $obj_usr->admin;
|
||||||
|
|
||||||
|
$labeltoshow = dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
|
||||||
|
if (empty($obj_usr->firstname) && empty($obj_usr->lastname)) $labeltoshow = $obj_usr->login;
|
||||||
|
|
||||||
$out .= '<option value="'.$obj_usr->rowid.'"';
|
$out .= '<option value="'.$obj_usr->rowid.'"';
|
||||||
|
|
||||||
if ($obj_usr->rowid == $selected) $out .= ' selected';
|
if ($obj_usr->rowid == $selected) $out .= ' selected';
|
||||||
|
$out .= ' data-html="';
|
||||||
|
$outhtml = '';
|
||||||
|
if (!empty($obj_usr->photo))
|
||||||
|
{
|
||||||
|
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
|
||||||
|
}
|
||||||
|
if ($showstatus >= 0 && $obj_usr->status == 0) $outhtml .= '<strike class="opacitymediumxxx">';
|
||||||
|
$outhtml .= $labeltoshow;
|
||||||
|
if ($showstatus >= 0 && $obj_usr->status == 0) $outhtml .= '</strike>';
|
||||||
|
$out .= dol_escape_htmltag($outhtml);
|
||||||
|
$out .= '">';
|
||||||
|
|
||||||
$out .= '>';
|
$out .= $labeltoshow;
|
||||||
$out .= dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
|
|
||||||
// Complete name with more info
|
// Complete name with more info
|
||||||
$moreinfo = 0;
|
$moreinfo = 0;
|
||||||
if (!empty($conf->global->MAIN_SHOW_LOGIN))
|
if (!empty($conf->global->MAIN_SHOW_LOGIN))
|
||||||
@ -497,12 +520,12 @@ class FormOther
|
|||||||
}
|
}
|
||||||
if ($showstatus >= 0)
|
if ($showstatus >= 0)
|
||||||
{
|
{
|
||||||
if ($obj_usr->statut == 1 && $showstatus == 1)
|
if ($obj_usr->status == 1 && $showstatus == 1)
|
||||||
{
|
{
|
||||||
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
|
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
|
||||||
$moreinfo++;
|
$moreinfo++;
|
||||||
}
|
}
|
||||||
if ($obj_usr->statut == 0)
|
if ($obj_usr->status == 0)
|
||||||
{
|
{
|
||||||
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
|
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
|
||||||
$moreinfo++;
|
$moreinfo++;
|
||||||
|
|||||||
@ -505,7 +505,8 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
|
|||||||
// If the user can view user other than himself
|
// If the user can view user other than himself
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('ProjectsWithThisUserAsContact').': ';
|
$moreforfilter .= $langs->trans('ProjectsWithThisUserAsContact').': ';
|
||||||
$includeonly = 'hierarchyme';
|
//$includeonly = 'hierarchyme';
|
||||||
|
$includeonly = '';
|
||||||
if (empty($user->rights->user->user->lire)) $includeonly = array($user->id);
|
if (empty($user->rights->user->user->lire)) $includeonly = array($user->id);
|
||||||
$moreforfilter .= $form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
$moreforfilter .= $form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user