EntityUtil.filterByDate valid at fromDate
-----------------------------------------
Key: OFBIZ-99
URL: http://issues.apache.org/jira/browse/OFBIZ-99
Project: OFBiz (The Open for Business Project)
Issue Type: Improvement
Components: framework
Affects Versions: SVN trunk
Reporter: Si Chen
Priority: Minor
Fix For: SVN trunk
I think we should re-open the issue OFBIZ-168 from the old JIRA
(http://jira.undersunconsulting.com/browse/OFBIZ-168) These are the comments
from Peter Goron's email on April 14, 2006:
-------------
Hi,
I would like to know if it is possible to reconsider JIRA #OFBIZ-168
issue. I am working on scheduling problems for industry and this bug is
really annoying.
I've spent almost two hours to find why some values were not returned by
EntityUtil.filterByDate whereas EntityUtil.getFilterByDateExpr returned
them correctly. The first one doesn't include values that are valid at
fromDate.
I think it will be more consistent for the framework that two methods
have the same behavior.
Attached to this mail, the patch that fix this issue.
Peter
Index: framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
===================================================================
--- framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (revision 7293)
+++ framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (working copy)
@@ -179,7 +179,7 @@
java.sql.Timestamp fromDate = (java.sql.Timestamp)
datedValue.dangerousGetNoCheckButFast(fromDateField);
java.sql.Timestamp thruDate = (java.sql.Timestamp)
datedValue.dangerousGetNoCheckButFast(thruDateField);
- if ((thruDate == null || thruDate.after(moment)) && (fromDate
== null || fromDate.before(moment))) {
+ if ((thruDate == null || thruDate.after(moment)) && (fromDate
== null || fromDate.before(moment) || fromDate.equals(moment))) {
result.add(datedValue);
}// else not active at moment
}
@@ -188,7 +188,7 @@
java.sql.Timestamp fromDate = (java.sql.Timestamp)
datedValue.dangerousGetNoCheckButFast(fromDateField);
java.sql.Timestamp thruDate = (java.sql.Timestamp)
datedValue.dangerousGetNoCheckButFast(thruDateField);
- if ((thruDate == null || thruDate.after(moment)) && (fromDate
== null || fromDate.before(moment))) {
+ if ((thruDate == null || thruDate.after(moment)) && (fromDate
== null || fromDate.before(moment) || fromDate.equals(moment))) {
result.add(datedValue);
}// else not active at moment
}
@@ -199,7 +199,7 @@
java.sql.Timestamp fromDate =
datedValue.getTimestamp(fromDateName);
java.sql.Timestamp thruDate =
datedValue.getTimestamp(thruDateName);
- if ((thruDate == null || thruDate.after(moment)) && (fromDate
== null || fromDate.before(moment))) {
+ if ((thruDate == null || thruDate.after(moment)) && (fromDate
== null || fromDate.before(moment) || fromDate.equals(moment))) {
result.add(datedValue);
}// else not active at moment
}
@@ -216,7 +216,7 @@
java.sql.Timestamp fromDate = datedValue.getTimestamp(fromDateName);
java.sql.Timestamp thruDate = datedValue.getTimestamp(thruDateName);
- if ((thruDate == null || thruDate.after(moment)) && (fromDate == null
|| fromDate.before(moment))) {
+ if ((thruDate == null || thruDate.after(moment)) && (fromDate == null
|| fromDate.before(moment) || fromDate.equals(moment))) {
return true;
} else {
// else not active at moment
---------------
I will test it myself to make sure it has no bad consequences. If there are no
objections, I'd like to commit this.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira