Bug #1534: Fix query to get info about expenses associated to an order

The query was just getting the tasks with parent the order, but not all the
sub-tasks.

A similar code that for the case of imputed hours has been used for the expenses
case fixing the issue.

FEA: ItEr77S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2012-09-19 12:38:58 +02:00
parent 7e0295166c
commit 1d0d40f449

View file

@ -445,9 +445,6 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
+ "LEFT OUTER JOIN expense.orderElement exp_ord " + "LEFT OUTER JOIN expense.orderElement exp_ord "
+ "WHERE orderElement.id = exp_ord.id "; + "WHERE orderElement.id = exp_ord.id ";
if (!orders.isEmpty()) {
strQuery += "AND orderElement.parent IN (:orders) ";
}
if (startingDate != null && endingDate != null) { if (startingDate != null && endingDate != null) {
strQuery += "AND expense.date BETWEEN :startingDate AND :endingDate "; strQuery += "AND expense.date BETWEEN :startingDate AND :endingDate ";
} }
@ -464,9 +461,6 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
Query query = getSession().createQuery(strQuery); Query query = getSession().createQuery(strQuery);
// Set parameters // Set parameters
if (!orders.isEmpty()) {
query.setParameterList("orders", orders);
}
if (startingDate != null) { if (startingDate != null) {
query.setParameter("startingDate", new LocalDate(startingDate)); query.setParameter("startingDate", new LocalDate(startingDate));
} }
@ -480,7 +474,8 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
for (CostExpenseSheetDTO each : list) { for (CostExpenseSheetDTO each : list) {
Order order = loadOrderAvoidingProxyFor(each.getOrderElement()); Order order = loadOrderAvoidingProxyFor(each.getOrderElement());
// Apply filtering // Apply filtering
if (matchFilterCriterion(each.getOrderElement(), criterions)) { if (matchFilterCriterion(each.getOrderElement(), criterions)
&& isOrderContained(order, orders)) {
each.setOrder(order); each.setOrder(order);
filteredList.add(each); filteredList.add(each);
} }