From 2615a1f1529cc88851411f3cf6b5e30a18b03c48 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 15:34:45 +0200 Subject: [PATCH 1/3] Update list.php --- htdocs/user/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index fe05c551945..6d0fecb6210 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -126,6 +126,7 @@ $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), @@ -154,6 +155,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'); @@ -223,6 +225,7 @@ if (empty($reshook)) { $search_email = ""; $search_statut = ""; $search_thirdparty = ""; + $search_warehouse = ""; $search_supervisor = ""; $search_api_key = ""; $search_datelastlogin = ""; @@ -362,6 +365,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); } 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 2/3] 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 .= '
'; } From 7b0d0805f2f76daa82ea1517b33f0d5d624d2f89 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 22:14:45 +0200 Subject: [PATCH 3/3] Update list.php --- htdocs/user/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 337d02ec8a2..debe3e35d12 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -610,6 +610,7 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $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);