From 97eedb866bedf92be38af7e84974920776767f13 Mon Sep 17 00:00:00 2001
From: Alexis Algoud <alexis@atm-consulting.fr>
Date: Wed, 6 Jul 2016 10:36:58 +0200
Subject: [PATCH] FIX add POST key on print link (avoid action in case of) in
 order to keep filter on list and other case

---
 htdocs/main.inc.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 5e919498a9b..3f790907fc1 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1480,7 +1480,12 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
 	    if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone))
 	    {
 	        $qs=$_SERVER["QUERY_STRING"];
-	        $qs.=(($qs && $morequerystring)?'&':'').$morequerystring;
+	        
+			foreach($_POST as $key=>$value) {
+				if($key!=='action')$qs.='&'.$key.'='.urlencode($value);
+			} 
+			
+			$qs.=(($qs && $morequerystring)?'&':'').$morequerystring;
 	        $text ='<a href="'.$_SERVER["PHP_SELF"].'?'.$qs.($qs?'&':'').'optioncss=print" target="_blank">';
 	        $text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
 	        $text.='</a>';
-- 
GitLab