From 842268df106edcb7b2c2db51cbeee811207b2a90 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 22:11:41 +0200 Subject: [PATCH] Update list.php --- htdocs/user/list.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 6d0fecb6210..337d02ec8a2 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -126,7 +126,6 @@ $arrayfields = array( 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35), 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>($conf->api->enabled && $user->admin)), 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), - 'u.fk_warehouse'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), 'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))), 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100), 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110), @@ -416,6 +415,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.fk_user IN (".$db->sanitize(join(',', $childids)).")"; } @@ -523,7 +525,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'; @@ -601,8 +606,16 @@ $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 .= '
'; +} +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 .= '
'; }