NEW Show image of user in the combo select of users

This commit is contained in:
Laurent Destailleur 2020-10-17 13:27:39 +02:00
parent 5df1218d9f
commit 20b6d3828e
2 changed files with 20 additions and 10 deletions

View File

@ -640,7 +640,7 @@ if ($resql)
print '</td>';
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth150');
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth150');
print '</td>';
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
@ -959,9 +959,8 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if ($fieldlist[$field] == 'fk_user')
{
print '<td>';
if ($user->admin)
{
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200');
if ($user->admin) {
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
} else {
if ($context == 'add') // I am not admin and we show the add form
{

View File

@ -1646,7 +1646,7 @@ class Form
$outarray = array();
// Forge request to select users
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut as status, u.login, u.admin, u.entity, u.photo";
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity)
{
$sql .= ", e.label";
@ -1710,6 +1710,10 @@ class Form
$userstatic->id = $obj->rowid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->photo = $obj->photo;
$userstatic->statut = $obj->status;
$userstatic->entity = $obj->entity;
$userstatic->admin = $obj->admin;
$disableline = '';
if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) $disableline = ($enableonlytext ? $enableonlytext : '1');
@ -1732,11 +1736,11 @@ class Form
}
if ($showstatus >= 0)
{
if ($obj->statut == 1 && $showstatus == 1)
if ($obj->status == 1 && $showstatus == 1)
{
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
}
if ($obj->statut == 0 && $showstatus == 1)
if ($obj->status == 0 && $showstatus == 1)
{
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
}
@ -1762,10 +1766,17 @@ class Form
if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected))) {
$out .= ' selected';
}
if ($showstatus >= 0 && $obj->statut == 0) {
$out .= ' data-html="'.dol_escape_htmltag('<strike class="opacitymediumxxx">'.$labeltoshow.'</strike>').'"';
$out .= ' data-html="';
$outhtml = '';
if (!empty($obj->photo))
{
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
}
$out .= '>';
if ($showstatus >= 0 && $obj->status == 0) $outhtml .= '<strike class="opacitymediumxxx">';
$outhtml .= $labeltoshow;
if ($showstatus >= 0 && $obj->status == 0) $outhtml .= '</strike>';
$out .= dol_escape_htmltag($outhtml);
$out .= '">';
$out .= $labeltoshow;
$out .= '</option>';