Author: erwan
Date: Tue Apr 26 19:43:01 2011
New Revision: 1096871
URL:
http://svn.apache.org/viewvc?rev=1096871&view=revLog:
A patch from Pierre Gaudin - error in pagination target with on-event-update-area parameters - OFBIZ-4249
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1096871&r1=1096870&r2=1096871&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Tue Apr 26 19:43:01 2011
@@ -2910,17 +2910,16 @@ public class MacroFormRenderer implement
Map<String, String> parameters = updateArea.getParameterMap(ctx);
String targetUrl = updateArea.getAreaTarget(context);
String ajaxParams = getAjaxParamsFromTarget(targetUrl);
- if (UtilValidate.isNotEmpty(extraParams)) {
- if (ajaxParams.length() > 0 && !extraParams.startsWith("&")) {
- ajaxParams += "&";
- }
- ajaxParams += extraParams;
- }
+ //add first parameters from updateArea parameters
if(UtilValidate.isNotEmpty(parameters)){
if(UtilValidate.isEmpty(ajaxParams)){
ajaxParams = "";
}
for (String key : parameters.keySet()) {
+ //test if ajax parameters are not already into extraParams, if so do not add it
+ if(UtilValidate.isNotEmpty(extraParams) && extraParams.contains(parameters.get(key))){
+ continue;
+ }
if (ajaxParams.length() > 0 && ajaxParams.indexOf(key) < 0) {
ajaxParams += "&";
}
@@ -2929,6 +2928,13 @@ public class MacroFormRenderer implement
}
}
}
+ //then add parameters from request. Those parameters could end with an anchor so we must set ajax parameters first
+ if (UtilValidate.isNotEmpty(extraParams)) {
+ if (ajaxParams.length() > 0 && !extraParams.startsWith("&")) {
+ ajaxParams += "&";
+ }
+ ajaxParams += extraParams;
+ }
ajaxUrl += updateArea.getAreaId() + ",";
ajaxUrl += this.rh.makeLink(this.request, this.response, UtilHttp.removeQueryStringFromTarget(targetUrl));
ajaxUrl += "," + ajaxParams;