This is an automated email from the ASF dual-hosted git repository.
nmalin pushed a commit to branch trunk
in repository
https://gitbox.apache.org/repos/asf/ofbiz-framework.gitThe following commit(s) were added to refs/heads/trunk by this push:
new 8160683 Improved: Improve makeRangeCondition in file EntityDateFilterCondition.java (OFBIZ-12051)
8160683 is described below
commit 816068335c4886b5d34274dd699e9d97625015c3
Author: Nicolas Malin <
[hidden email]>
AuthorDate: Sun Nov 29 19:21:23 2020 +0100
Improved: Improve makeRangeCondition in file EntityDateFilterCondition.java
(OFBIZ-12051)
When we have a value with both from and thrudate greater than given range
Thanks to Leila Mekika for this improvement
---
.../apache/ofbiz/entity/condition/EntityDateFilterCondition.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java
index c3055a7..892bd72 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java
@@ -142,6 +142,7 @@ public final class EntityDateFilterCondition implements EntityCondition {
* - fromDate is null and thruDate is equal to or after rangeStart
* - thruDate is null and fromDate is before rangeEnd
* - fromDate is null and thruDate is null
+ * - fromDate is before rangeStart and thruDate is after rangeEnd
* @param rangeStart The start of the range to filter against
* @param rangeEnd The end of the range to filter against
* @param fromDateName The name of the field containing the entity's "fromDate"
@@ -163,6 +164,9 @@ public final class EntityDateFilterCondition implements EntityCondition {
EntityCondition.makeCondition(thruDateName, EntityOperator.GREATER_THAN_EQUAL_TO, rangeStart)),
EntityCondition.makeCondition(
EntityCondition.makeCondition(thruDateName, null),
- EntityCondition.makeCondition(fromDateName, EntityOperator.LESS_THAN, rangeEnd)));
+ EntityCondition.makeCondition(fromDateName, EntityOperator.LESS_THAN, rangeEnd)),
+ EntityCondition.makeCondition(
+ EntityCondition.makeCondition(fromDateName, EntityOperator.LESS_THAN_EQUAL_TO, rangeStart),
+ EntityCondition.makeCondition(thruDateName, EntityOperator.GREATER_THAN_EQUAL_TO, rangeEnd)));
}
}