From b053b55e2fec74ccc2fbffae5957163cde1414ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jan 2024 11:15:17 +0100 Subject: [PATCH] FIX link to print when there is a search on multiselect fields --- htdocs/main.inc.php | 17 ++++++++++++++--- htdocs/product/stock/stockatdate.php | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2690ad2af84..0895077bc18 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2158,14 +2158,25 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); } - // Link to print main content area + // Link to print main content area (optioncss=print) if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $qs = dol_escape_htmltag($_SERVER["QUERY_STRING"]); if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { - if ($key !== 'action' && $key !== 'password' && !is_array($value)) { - $qs .= '&'.$key.'='.urlencode($value); + if (in_array($key, array('action', 'massaction', 'password'))) { + continue; + } + if (!is_array($value)) { + if ($value !== '') { + $qs .= '&'.$key.'='.urlencode($value); + } + } else { + foreach ($value as $value2) { + if ($value2 !== '') { + $qs .= '&'.$key.'[]='.urlencode($value2); + } + } } } } diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index bfc3b92b2a9..1503e439749 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -427,7 +427,7 @@ if (!empty($search_fk_warehouse)) { } } if ($productid > 0) { - $param .= '&productid='.$productid; + $param .= '&productid='.(int) $productid; } if (GETPOST('dateday', 'int') > 0) { $param .= '&dateday='.GETPOST('dateday', 'int');