From 85f6a15678ac3649e7bdaa4fdfa126fbdd13599f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Mar 2021 11:58:51 +0200 Subject: [PATCH] Fix position of users in combo list --- htdocs/commande/list.php | 20 ++++++++++---------- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/core/class/html.formother.class.php | 7 ++++++- htdocs/fourn/facture/list.php | 16 ++++++++-------- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0b850e6b0e8..df79a9edffd 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -806,39 +806,39 @@ if ($resql) { if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': '; - $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200'); + $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250'); $moreforfilter .= '
'; } // If the user can view other users if ($user->rights->user->user->lire) { $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('LinkedToSpecificUsers').': '; - $moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); + $tmptitle = $langs->trans('LinkedToSpecificUsers'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= '
'; } // If the user can view prospects other than his' if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('IncludingProductWithTag').': '; + $tmptitle = $langs->trans('IncludingProductWithTag'); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); - $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': '; - $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1); + $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle); $moreforfilter .= '
'; } if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Warehouse').': '; - $moreforfilter .= $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1); + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'warehouse', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle); $moreforfilter .= '
'; } $parameters = array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f12aed42aca..628c6a2ff04 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1931,9 +1931,9 @@ class Form } if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname - $sql .= " ORDER BY u.firstname ASC"; + $sql .= " ORDER BY u.statut DESC, u.firstname ASC, u.lastname ASC"; } else { - $sql .= " ORDER BY u.lastname ASC"; + $sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC"; } dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 78212ca3580..533328599c8 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -481,7 +481,12 @@ class FormOther $sql_usr .= $hookmanager->resArray[1]; } } - $sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. + + if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname + $sql_usr .= " ORDER BY statut DESC, firstname ASC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. + } else { + $sql_usr .= " ORDER BY statut DESC, lastname ASC, firstname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. + } //print $sql_usr;exit; $resql_usr = $this->db->query($sql_usr); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 50fdfef6e47..3efc19f86cc 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -934,32 +934,32 @@ if ($resql) { if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': '; - $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200'); + $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); + $moreforfilter .= img_picto($tmptitle, 'company', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth200'); $moreforfilter .= '
'; } // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('LinkedToSpecificUsers').': '; - $moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); + $tmptitle = $langs->trans('LinkedToSpecificUsers'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter .= '
'; } // If the user can view prospects other than his' if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('IncludingProductWithTag').': '; + $tmptitle = $langs->trans('IncludingProductWithTag'); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); - $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } if (!empty($conf->categorie->enabled)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('SuppliersCategoriesShort').': '; - $moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1); + $tmptitle = $langs->trans('SuppliersCategoriesShort'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1, $tmptitle); $moreforfilter .= '
'; } $parameters = array();