You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2010/11/11 23:17:34 UTC
svn commit: r1034177 - in /ofbiz/branches/jquery/framework:
common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
images/webapp/images/fieldlookup.js
Author: jleroux
Date: Thu Nov 11 22:17:34 2010
New Revision: 1034177
URL: http://svn.apache.org/viewvc?rev=1034177&view=rev
Log:
Improves lookup description initialization.
* Fixes a bug when the lookup field name is not an entity field name (FindAutocompleteOptions.groovy)
* Avoids to set the description if empty (fieldlookup.js)
Modified:
ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js
Modified: ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy?rev=1034177&r1=1034176&r2=1034177&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy (original)
+++ ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy Thu Nov 11 22:17:34 2010
@@ -37,7 +37,7 @@ def searchValueFieldName = parameters.te
def fieldValue = null;
if (searchValueFieldName) {
fieldValue = searchValueFieldName;
-} else if (parameters.searchValueFieldName) {
+} else if (parameters.searchValueFieldName) { // This is to find the description of a lookup value on initialization.
fieldValue = parameters.get(parameters.searchValueFieldName);
context.description = "true";
}
@@ -52,8 +52,8 @@ if (searchFields && fieldValue) {
returnField = parameters.searchValueFieldName;
} else {
returnField = searchFieldsList[0]; //default to first element of searchFields
+ displayFieldsSet.add(returnField); //add it to select fields, in case it is missing
}
- displayFieldsSet.add(returnField); //add it to select fields, in case it is missing
context.returnField = returnField;
context.displayFieldsSet = displayFieldsSet;
if ("STARTS_WITH".equals(searchType)) {
@@ -65,7 +65,7 @@ if (searchFields && fieldValue) {
}
searchFieldsList.each { fieldName ->
if ("EQUALS".equals(searchType)) {
- orExprs.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(returnField), EntityOperator.EQUALS, searchValue));
+ orExprs.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(searchFieldsList[0]), EntityOperator.EQUALS, searchValue));
return;//in case of EQUALS, we search only a match for the returned field
} else {
orExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, searchValue));
Modified: ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js?rev=1034177&r1=1034176&r2=1034177&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js Thu Nov 11 22:17:34 2010
@@ -729,8 +729,10 @@ jQuery.extend(lookupDescriptionLoaded.pr
data: this.allParams,
async: false,
success: function(result){
- // This would be far more reliable if we would remove the widget boundaries in LookupDecorator using widgetVerbose in context
- setLookDescription(_fieldId, result.split("ajaxAutocompleteOptions.ftl -->")[1].trim().split("<!--")[0].trim(), "", "");
+ // This would be far more reliable if we would remove the widget boundaries in LookupDecorator using widgetVerbose in context
+ if (result.split("ajaxAutocompleteOptions.ftl -->")[1]) {
+ setLookDescription(_fieldId, result.split("ajaxAutocompleteOptions.ftl -->")[1].trim().split("<!--")[0].trim(), "", "");
+ }
}
});
}