New: More options to select status of users into select user list.

This commit is contained in:
Laurent Destailleur 2013-07-27 14:45:55 +02:00
parent 67820774bb
commit 444a3328c6
3 changed files with 52 additions and 15 deletions

View File

@ -4,6 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.5 compared to 3.4.* *****
For users:
- New: More options to select status of users into select user list.
- New: [ task #862 ] Add ODT on shipments
- New: [ task #149 ] Add # of notes and attachments in tabs
- New: Can edit customer ref at eny time.

View File

@ -1080,7 +1080,7 @@ class Form
* @param array $enableonly Array list of users id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus Show user status into label
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @return string HTML select string
*/
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0)
@ -1166,20 +1166,40 @@ class Form
}
$out.= $userstatic->getFullName($langs, 0, 0, $maxlength);
if ($showstatus)
// Complete name with more info
$moreinfo=0;
if (! empty($conf->global->MAIN_SHOW_LOGIN))
{
if ($obj->statut == 1) $out.=" (".$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4').")";
else $out.=" (".$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5').")";
$out.= ($moreinfo?' - ':' (').$obj->login;
$moreinfo++;
}
if ($showstatus >= 0)
{
if ($obj->statut == 1 && $showstatus == 1)
{
$out.=($moreinfo?' - ':' (').$langs->trans('Enabled');
$moreinfo++;
}
if ($obj->statut == 0)
{
$out.=($moreinfo?' - ':' (').$langs->trans('Disabled');
$moreinfo++;
}
}
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
if ($obj->admin && ! $obj->entity) $out.=" (".$langs->trans("AllEntities").")";
else $out.=" (".$obj->label.")";
if ($obj->admin && ! $obj->entity)
{
$out.=($moreinfo?' - ':' (').$langs->trans("AllEntities");
$moreinfo++;
}
else
{
$out.=($moreinfo?' - ':' (').$obj->label;
$moreinfo++;
}
}
//if ($obj->admin) $out.= ' *';
if (! empty($conf->global->MAIN_SHOW_LOGIN)) $out.= ' ('.$obj->login.')';
$out.=($moreinfo?')':'');
$out.= '</option>';
$i++;

View File

@ -347,7 +347,7 @@ class FormOther
* @param string $selected Preselected value
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus Show user status into label
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @return string Html combo list code
*/
function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0)
@ -386,12 +386,28 @@ class FormOther
if ($obj_usr->rowid == $selected) $moreforfilter.=' selected="selected"';
$moreforfilter.='>';
$moreforfilter.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->name)." (".$obj_usr->login.')';
if ($showstatus)
$moreforfilter.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->name);
// Complete name with more info
$moreinfo=0;
if (! empty($conf->global->MAIN_SHOW_LOGIN))
{
if ($obj_usr->statut == 1) $moreforfilter.=" ". img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
else $moreforfilter.=" ". img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
$out.=($moreinfo?' - ':' (').$obj->login;
$moreinfo++;
}
if ($showstatus >= 0)
{
if ($obj_usr->statut == 1 && $showstatus == 1)
{
$moreforfilter.=($moreinfo?' - ':' (').$langs->trans('Enabled');
$moreinfo++;
}
if ($obj_usr->statut == 0)
{
$moreforfilter.=($moreinfo?' - ':' (').$langs->trans('Disabled');
$moreinfo++;
}
}
$moreforfilter.=($moreinfo?')':'');
$moreforfilter.='</option>';
}
$this->db->free($resql_usr);