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/12/05 19:43:44 UTC
svn commit: r1042396 -
/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
Author: jleroux
Date: Sun Dec 5 18:43:44 2010
New Revision: 1042396
URL: http://svn.apache.org/viewvc?rev=1042396&view=rev
Log:
A patch from Anne Jessel "Is Empty for text-find widget broken" (https://issues.apache.org/jira/browse/OFBIZ-4025) - OFBIZ-4025
To reproduce:
* go to Facility, Inventory Items tab (or any form that uses text-find widget)
* choose "Is Empty" from drop-down next to Product Id
* click Find button
Expected behaviour: no matching items listed, as all items have a Product Id.
Observed behaviour: all items match.
Problem is caused by find code assuming that there is no entity condition to be created if the text field is empty, but of course Is Empty is
different to the other operators in that the text field is expected to be empty.
The attached patch adds a special check for the Is Empty operator.
Modified:
ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java?rev=1042396&r1=1042395&r2=1042396&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Sun Dec 5 18:43:44 2010
@@ -266,7 +266,7 @@ public class FindServices {
if (fieldValue == null) {
fieldValue = parameters.get(fieldName);
}
- if (ObjectType.isEmpty(fieldValue)) {
+ if (ObjectType.isEmpty(fieldValue) && !"empty".equals(operation)) {
continue;
}
result.add(createSingleCondition(modelField, operation, fieldValue, ignoreCase, delegator, context));
@@ -372,10 +372,11 @@ public class FindServices {
}
subMap2 = subMap.get("fld0");
fieldValue = subMap2.get("value");
- if (fieldValue == null) {
+ opString = (String) subMap2.get("op");
+ // null fieldValue is OK if operator is "empty"
+ if (fieldValue == null && !"empty".equals(opString)) {
continue;
}
- opString = (String) subMap2.get("op");
ignoreCase = "Y".equals(subMap2.get("ic"));
cond = createSingleCondition(modelField, opString, fieldValue, ignoreCase, delegator, context);
tmpList.add(cond);
@@ -384,10 +385,10 @@ public class FindServices {
continue;
}
fieldValue = subMap2.get("value");
- if (fieldValue == null) {
+ opString = (String) subMap2.get("op");
+ if (fieldValue == null && !"empty".equals(opString)) {
continue;
}
- opString = (String) subMap2.get("op");
ignoreCase = "Y".equals(subMap2.get("ic"));
cond = createSingleCondition(modelField, opString, fieldValue, ignoreCase, delegator, context);
tmpList.add(cond);