diff --git a/htdocs/user/list.php b/htdocs/user/list.php index afe08969e45..a697fdf96c0 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -154,6 +154,7 @@ $search_email = GETPOST('search_email', 'alpha'); $search_api_key = GETPOST('search_api_key', 'alphanohtml'); $search_statut = GETPOST('search_statut', 'intcomma'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); +$search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_supervisor = GETPOST('search_supervisor', 'intcomma'); $optioncss = GETPOST('optioncss', 'alpha'); $search_categ = GETPOST("search_categ", 'int'); @@ -230,6 +231,7 @@ if (empty($reshook)) { $search_email = ""; $search_statut = ""; $search_thirdparty = ""; + $search_warehouse = ""; $search_supervisor = ""; $search_api_key = ""; $search_datelastlogin = ""; @@ -369,6 +371,9 @@ if ($search_supervisor > 0) { if ($search_thirdparty != '') { $sql .= natural_search(array('s.nom'), $search_thirdparty); } +if ($search_warehouse != '') { + $sql .= natural_search(array('u.fk_warehouse'), $search_warehouse); +} if ($search_login != '') { $sql .= natural_search("u.login", $search_login); } @@ -417,6 +422,9 @@ if ($search_categ > 0) { if ($search_categ == -2) { $sql .= " AND cu.fk_categorie IS NULL"; } +if ($search_warehouse > 0) { + $sql .= " AND u.fk_warehouse = ".$db->escape($search_warehouse); +} if ($mode == 'employee' && empty($user->rights->salaries->readall)) { $sql .= " AND u.rowid IN (".$db->sanitize(join(',', $childids)).")"; } @@ -524,7 +532,10 @@ if ($mode != '') { $param .= '&mode='.urlencode($mode); } if ($search_categ > 0) { - $param .= "&search_categ=".urlencode($search_categ); + $param .= '&search_categ='.urlencode($search_categ); +} +if ($search_warehouse > 0) { + $param .= '&search_warehouse='.urlencode($search_warehouse); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -602,8 +613,17 @@ $moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="paddingright"'); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); + $tmptitle = $langs->trans('Category'); + $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1, $tmptitle); + $moreforfilter .= '
'; +} +// Filter on warehouse +if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); $moreforfilter .= '
'; }