-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEW multiselect search_sale in list societe #29110
NEW multiselect search_sale in list societe #29110
Conversation
htdocs/societe/list.php
Outdated
@@ -97,7 +97,7 @@ | |||
$search_idprof5 = trim(GETPOST('search_idprof5', 'alpha')); | |||
$search_idprof6 = trim(GETPOST('search_idprof6', 'alpha')); | |||
$search_vat = trim(GETPOST('search_vat', 'alpha')); | |||
$search_sale = GETPOSTINT("search_sale"); | |||
$search_sale = GETPOST("search_sale", 'alphanohtml'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to new code search_sale is an array of int. So you should use
$search_sale = GETPOST('search_sale', 'array:int');
And to be compatible with old url (bookmarked for exemple), you can do
if (GETPOSTISARRAY('search_sale')) {
$search_sale = GETPOST('search_sale', 'array:int');
} else {
$search_sale = array(GETPOSTINT($search_sale));
}
Later
$search_sale_req = implode(',', $search_sale_req);
can become
$search_sale_req = implode(',', $search_sale);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for the first suggestion
if (GETPOSTISARRAY('search_sale')) {
$search_sale = GETPOST('search_sale', 'array:int');
} else if (GETPOSTISSET('search_sale')) {
$search_sale = array(GETPOSTINT('search_sale'));
}
for the second
$search_sale_req must be different de $search_sale
because it must not contain "-2" = (no sales staff)
the case of -2
elseif (count($search_sale) > 0 && in_array('-2', $search_sale)) {
$sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req)."))";
$sql .= " OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
}
in my block following
$search_sale_req = implode(',', $search_sale_req);
I need both variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…EW_MULTISELECT_LIST_SOCIETE
…n/dolibarr into NEW_MULTISELECT_LIST_SOCIETE
Instructions
In htdocs/societe/list.php :
Replace button search simple Select commercial by Multiselect in list societe
Now we can search for multiple companies belonging to several sales representatives.
But also third parties without sales representatives.
NEW|New [New multiselect list societe]
Replace méthode select_salesrepresentatives() by multiselectarray()