FIX added information on user list not visible with multiselect

This commit is contained in:
Laurent Destailleur 2020-08-28 17:17:22 +02:00
parent 30838f01d4
commit 0b8d7f329e

View File

@ -1753,43 +1753,39 @@ class Form
$out .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
// Complete name with more info
$moreinfo = 0;
$moreinfo = '';
if (!empty($conf->global->MAIN_SHOW_LOGIN))
{
$out .= ($moreinfo ? ' - ' : ' (').$obj->login;
$moreinfo++;
$moreinfo .= ($moreinfo ? ' - ' : ' (').$obj->login;
}
if ($showstatus >= 0)
{
if ($obj->statut == 1 && $showstatus == 1)
{
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
$moreinfo++;
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
}
if ($obj->statut == 0)
{
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
$moreinfo++;
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
}
}
if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
{
if (!$obj->entity)
{
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
$moreinfo++;
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
} else {
$out .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
$moreinfo++;
$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
}
}
$out .= ($moreinfo ? ')' : '');
$moreinfo .= ($moreinfo ? ')' : '');
if ($disableline && $disableline != '1')
{
$out .= ' - '.$disableline; // This is text from $enableonlytext parameter
$moreinfo .= ' - '.$disableline; // This is text from $enableonlytext parameter
}
$out .= $moreinfo;
$out .= '</option>';
$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
$i++;
}
@ -6378,7 +6374,7 @@ class Form
* @param string $htmlname Name of select
* @param array $array Array with key+value
* @param array $selected Array with key+value preselected
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param int $key_in_label 1 to show key like in "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $morecss Add more css style
* @param int $translate Translate and encode value
@ -6404,7 +6400,7 @@ class Form
// Add code for jquery to use multiselect
if (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))
{
$out .= "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.' -->
<script>'."\n";
if ($addjscombo == 1)
{
@ -6465,15 +6461,16 @@ class Form
{
foreach ($array as $key => $value)
{
$newval = ($translate ? $langs->trans($value) : $value);
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
$out .= '<option value="'.$key.'"';
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != ''))
{
$out .= ' selected';
}
$out .= ' data-html="'.$newval.'"';
$out .= '>';
$newval = ($translate ? $langs->trans($value) : $value);
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
$out .= dol_htmlentitiesbr($newval);
$out .= '</option>'."\n";
}