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 _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev EntityUtil.patch (2K) Download Attachment |
In response to David's question before closing Jira
168: It would be of significance when a date is entered instead of a timestamp. Entering just the date would truncate the timestamp entry to midnight. So, any search for things that happened for one date would not include that truncated entry. --- Peter Goron <[hidden email]> wrote: > 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 > (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) > > 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 > > > _______________________________________________ > Dev mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/dev _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev |
In reply to this post by Peter Goron
I think it probably couldn't hurt to include this.
Si Peter Goron wrote: 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 _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev |
Free forum by Nabble | Edit this page |