Browse Source

Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0

Laurent Destailleur 2 years ago
parent
commit
1888d561d6

+ 28 - 17
htdocs/bookmarks/bookmarks.lib.php

@@ -36,28 +36,39 @@ function printDropdownBookmarksList()
 
 	$langs->load("bookmarks");
 
+	$authorized_var=array('limit','optioncss','contextpage');
 	$url = $_SERVER["PHP_SELF"];
-
+	$url_param=array();
 	if (!empty($_SERVER["QUERY_STRING"])) {
-		$url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '');
-	} else {
-		global $sortfield, $sortorder;
-		$tmpurl = '';
-		// No urlencode, all param $url will be urlencoded later
-		if ($sortfield) {
-			$tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield);
-		}
-		if ($sortorder) {
-			$tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder);
-		}
-		if (is_array($_POST)) {
-			foreach ($_POST as $key => $val) {
-				if (preg_match('/^search_/', $key) && $val != '') {
-					$tmpurl .= ($tmpurl ? '&' : '').http_build_query(array($key => $val));
+		if (is_array($_GET)) {
+			foreach ($_GET as $key => $val) {
+				if ($val != '') {
+					$url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
 				}
 			}
 		}
-		$url .= ($tmpurl ? '?'.$tmpurl : '');
+	}
+	global $sortfield, $sortorder;
+	$tmpurl = '';
+	// No urlencode, all param $url will be urlencoded later
+	if ($sortfield) {
+		$tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield);
+	}
+	if ($sortorder) {
+		$tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder);
+	}
+	if (is_array($_POST)) {
+		foreach ($_POST as $key => $val) {
+			if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var))
+				&& $val != ''
+				&& !array_key_exists($key, $url_param)) {
+				$url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
+			}
+		}
+	}
+	$url .= ($tmpurl ? '?'.$tmpurl : '');
+	if (!empty($url_param)) {
+		$url .= '&'.implode('&', $url_param);
 	}
 
 	$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";

+ 1 - 1
htdocs/modulebuilder/template/myobject_list.php

@@ -450,7 +450,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
 	$param .= '&limit='.urlencode($limit);
 }
 foreach ($search as $key => $val) {
-	if (is_array($search[$key]) && count($search[$key])) {
+	if (is_array($search[$key])) {
 		foreach ($search[$key] as $skey) {
 			if ($skey != '') {
 				$param .= '&search_'.$key.'[]='.urlencode($skey);

+ 7 - 4
htdocs/ticket/list.php

@@ -139,7 +139,7 @@ foreach ($object->fields as $key => $val) {
 		$arrayfields['t.'.$key] = array(
 			'label'=>$val['label'],
 			'checked'=>(($visible < 0) ? 0 : 1),
-			'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
+			'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
 			'position'=>$val['position'],
 			'help'=> isset($val['help']) ? $val['help'] : ''
 		);
@@ -620,8 +620,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
 	$param .= '&limit='.urlencode($limit);
 }
 foreach ($search as $key => $val) {
-	if (is_array($val) && count($val)) {
-		foreach ($val as $skey) {
+	if (is_array($search[$key])) {
+		foreach ($search[$key] as $skey) {
 			if ($skey != '') {
 				$param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : "";
 			}
@@ -756,10 +756,13 @@ if ($massaction == 'presendonclose') {
 }
 
 if ($search_all) {
+	$setupstring = '';
 	foreach ($fieldstosearchall as $key => $val) {
 		$fieldstosearchall[$key] = $langs->trans($val);
+		$setupstring .= $key."=".$val.";";
 	}
-	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
+	print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
+	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
 }
 
 $moreforfilter = '';