diff --git a/ChangeLog b/ChangeLog index bbfdf2e114f..df475ff4be7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,7 +58,8 @@ For translators: - Update language files. 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. @@ -66,13 +67,13 @@ For developers: - LINEBILL_DELETE, LINK_DELETE, ORDER_SUPPLIER_DELETE, RESOURCE_DELETE trigger called before SQL delete - New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE. - New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE. -- New: Added hook "formConfirm" and "doActions" for supplier invoice card -- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card +- New: Added hook "formConfirm" and "doActions" for supplier invoice card. +- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. 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.* ***** diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bad36b32e2e..3b0afcb2b60 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1115,11 +1115,12 @@ class Form * @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 */ @@ -1134,7 +1135,21 @@ class Form 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 @@ -1166,7 +1181,8 @@ class Form 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);