From 13ddcb95527d68df15acc195d33bfe88f29f38fd Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 12 Jan 2024 18:04:00 +0100 Subject: [PATCH 1/2] fix: filter on date lost on sort (#27467) --- htdocs/comm/action/list.php | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 3305b44af46..0b0c8cb496f 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -345,41 +345,41 @@ if ($search_title != '') { if ($search_note != '') { $param .= '&search_note='.urlencode($search_note); } -if (GETPOST('datestartday_dtstart', 'int')) { - $param .= '&datestartday_dtstart='.GETPOST('datestartday_dtstart', 'int'); +if (GETPOST('datestart_dtstartday', 'int')) { + $param .= '&datestart_dtstartday='.GETPOST('datestart_dtstartday', 'int'); } -if (GETPOST('datestartmonth_dtstart', 'int')) { - $param .= '&datestartmonth_dtstart='.GETPOST('datestartmonth_dtstart', 'int'); +if (GETPOST('datestart_dtstartmonth', 'int')) { + $param .= '&datestart_dtstartmonth='.GETPOST('datestart_dtstartmonth', 'int'); } -if (GETPOST('datestartyear_dtstart', 'int')) { - $param .= '&datestartyear_dtstart='.GETPOST('datestartyear_dtstart', 'int'); +if (GETPOST('datestart_dtstartyear', 'int')) { + $param .= '&datestart_dtstartyear='.GETPOST('datestart_dtstartyear', 'int'); } -if (GETPOST('datestartday_dtend', 'int')) { - $param .= '&datestartday_dtend='.GETPOST('datestartday_dtend', 'int'); +if (GETPOST('datestart_dtendday', 'int')) { + $param .= '&datestart_dtendday='.GETPOST('datestart_dtendday', 'int'); } -if (GETPOST('datestartmonth_dtend', 'int')) { - $param .= '&datestartmonth_dtend='.GETPOST('datestartmonth_dtend', 'int'); +if (GETPOST('datestart_dtendmonth', 'int')) { + $param .= '&datestart_dtendmonth='.GETPOST('datestart_dtendmonth', 'int'); } -if (GETPOST('datestartyear_dtend', 'int')) { - $param .= '&datestartyear_dtend='.GETPOST('datestartyear_dtend', 'int'); +if (GETPOST('datestart_dtendyear', 'int')) { + $param .= '&datestart_dtendyear='.GETPOST('datestart_dtendyear', 'int'); } -if (GETPOST('dateendday_dtstart', 'int')) { - $param .= '&dateendday_dtstart='.GETPOST('dateendday_dtstart', 'int'); +if (GETPOST('dateend_dtstartday', 'int')) { + $param .= '&dateend_dtstartday='.GETPOST('dateend_dtstartday', 'int'); } -if (GETPOST('dateendmonth_dtstart', 'int')) { - $param .= '&dateendmonth_dtstart='.GETPOST('dateendmonth_dtstart', 'int'); +if (GETPOST('dateend_dtstartmonth', 'int')) { + $param .= '&dateend_dtstartmonth='.GETPOST('dateend_dtstartmonth', 'int'); } -if (GETPOST('dateendyear_dtstart', 'int')) { - $param .= '&dateendyear_dtstart='.GETPOST('dateendyear_dtstart', 'int'); +if (GETPOST('dateend_dtstartyear', 'int')) { + $param .= '&dateend_dtstartyear='.GETPOST('dateend_dtstartyear', 'int'); } -if (GETPOST('dateendday_dtend', 'int')) { - $param .= '&dateendday_dtend='.GETPOST('dateendday_dtend', 'int'); +if (GETPOST('dateend_dtendday', 'int')) { + $param .= '&dateend_dtendday='.GETPOST('dateend_dtendday', 'int'); } -if (GETPOST('dateendmonth_dtend', 'int')) { - $param .= '&dateendmonth_dtend='.GETPOST('dateendmonth_dtend', 'int'); +if (GETPOST('dateend_dtendmonth', 'int')) { + $param .= '&dateend_dtendmonth='.GETPOST('dateend_dtendmonth', 'int'); } -if (GETPOST('dateendyear_dtend', 'int')) { - $param .= '&dateendyear_dtend='.GETPOST('dateendyear_dtend', 'int'); +if (GETPOST('dateend_dtendyear', 'int')) { + $param .= '&dateend_dtendyear='.GETPOST('dateend_dtendyear', 'int'); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 2de0c09e8ea60d370052f292855ab579cfcaf3ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jan 2024 15:44:37 +0100 Subject: [PATCH 2/2] Try a better fix for #27477 --- htdocs/core/class/html.form.class.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c9c3e09f634..783f3afef74 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2247,7 +2247,7 @@ class Form * @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param int $limit Limit on number of returned lines * @param int $price_level Level of price to show - * @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell + * @param int $status Sell status: -1=No filter on sell status, 0=Products not on sell, 1=Products on sell * @param int $finished 2=all, 1=finished, 0=raw material * @param string $selected_input_value Value of preselected input text (for use with ajax) * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) @@ -2263,7 +2263,7 @@ class Form * 'warehouseinternal' = count products from warehouses for internal correct/transfer only * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @param string $nooutput No print, return the output into a string - * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase + * @param int $status_purchase Purchase status: -1=No filter on purchase status, 0=Products not on purchase, 1=Products on purchase * @return void|string */ public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1) @@ -2638,10 +2638,8 @@ class Form $sql .= " AND p.finished = ".((int) $finished); } elseif ($finished == 1) { $sql .= " AND p.finished = ".((int) $finished); - if ($status >= 0) { - $sql .= " AND p.tosell = ".((int) $status); - } - } elseif ($status >= 0) { + } + if ($status >= 0) { $sql .= " AND p.tosell = ".((int) $status); } if ($status_purchase >= 0) {