Fix position of users in combo list

This commit is contained in:
Laurent Destailleur 2021-03-29 11:58:51 +02:00
parent ad6f5e5a64
commit 85f6a15678
4 changed files with 26 additions and 21 deletions

View File

@ -806,39 +806,39 @@ if ($resql) {
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '</div>';
}
// If the user can view other users
if ($user->rights->user->user->lire) {
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '</div>';
}
// 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 .= '<div class="divsearchfield">';
$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 .= '</div>';
}
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '</div>';
}
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 .= '<div class="divsearchfield">';
$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 .= '</div>';
}
$parameters = array();

View File

@ -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);

View File

@ -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);

View File

@ -934,32 +934,32 @@ if ($resql) {
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) {
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '</div>';
}
// 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 .= '<div class="divsearchfield">';
$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 .= '</div>';
}
if (!empty($conf->categorie->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '</div>';
}
$parameters = array();