Skip to content

Commit

Permalink
Merge branch 'Upstream/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Aug 11, 2014
2 parents 0738103 + 4ce2495 commit 6fd77e7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
5 changes: 3 additions & 2 deletions ChangeLog
Expand Up @@ -62,7 +62,8 @@ For translators:
- New: When a translation is not available we always jump to en_US and only en_US.

For developers:
- New: getBrowserInfo can return type of layout (classic/phone/tablet)
- New: Select list of users can return user into hierarchy.
- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet)
- New: Add hook "searchAgendaFrom".
- New: Add trigger DON_UPDATE, DON_DELETE
- New: Add country iso code on 3 chars into table of countries.
Expand All @@ -77,7 +78,7 @@ For developers:
WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:

- Change the way parameters are provides to scripts sync_xxx_ldap2dolibarr.php
- Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php


***** ChangeLog for 3.6 compared to 3.5.* *****
Expand Down
24 changes: 20 additions & 4 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -1102,15 +1102,16 @@ function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array $include Array list of users id to include
* @param array $include Array list of users id to include or 'hierarchy' to have only supervised users
* @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 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request
* @return string HTML select string
* @see select_dolgroups
*/
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0)
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
{
global $conf,$user,$langs;

Expand All @@ -1121,7 +1122,21 @@ function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclu
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
// Permettre l'inclusion d'utilisateurs
if (is_array($include)) $includeUsers = implode("','",$include);

else if ($include == 'hierarchy')
{
// Build list includeUsers to have only hierarchy
$userid=$user->id;
$include=array();
if (empty($user->users) || ! is_array($user->users)) $user->get_full_tree();
foreach($user->users as $key => $val)
{
if (preg_match('/_'.$userid.'/',$val['fullpath'])) $include[]=$val['id'];
}
$includeUsers = implode("','",$include);
//var_dump($includeUsers);exit;
//var_dump($user->users);exit;
}

$out='';

// On recherche les utilisateurs
Expand Down Expand Up @@ -1153,7 +1168,8 @@ function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclu
if (! empty($user->societe_id)) $sql.= " AND u.fk_societe = ".$user->societe_id;
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')";
if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')";
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut<>0 ";
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut <> 0";
if (! empty($morefilter)) $sql.=$morefilter;
$sql.= " ORDER BY u.lastname ASC";

dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
Expand Down

0 comments on commit 6fd77e7

Please sign in to comment.