fixes the error that happens at filtering by dates in the report

about order cost per resource.

FEA: ItEr76S04BugFixing
This commit is contained in:
Susana Montes Pedreira 2012-06-19 15:11:05 +01:00
parent 3ffce11df7
commit a3bbc73f5d
2 changed files with 7 additions and 5 deletions

View file

@ -439,13 +439,13 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
strQuery += "AND orderElement.parent IN (:orders) ";
}
if (startingDate != null && endingDate != null) {
strQuery += "AND wrl.date BETWEEN :startingDate AND :endingDate ";
strQuery += "AND expense.date BETWEEN :startingDate AND :endingDate ";
}
if (startingDate != null && endingDate == null) {
strQuery += "AND wrl.date >= :startingDate ";
strQuery += "AND expense.date >= :startingDate ";
}
if (startingDate == null && endingDate != null) {
strQuery += "AND wrl.date <= :endingDate ";
strQuery += "AND expense.date <= :endingDate ";
}
// Order by date
@ -458,10 +458,10 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
query.setParameterList("orders", orders);
}
if (startingDate != null) {
query.setParameter("startingDate", startingDate);
query.setParameter("startingDate", new LocalDate(startingDate));
}
if (endingDate != null) {
query.setParameter("endingDate", endingDate);
query.setParameter("endingDate", new LocalDate(endingDate));
}
List<CostExpenseSheetDTO> list = query.list();

View file

@ -140,6 +140,7 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
Date startDateLine = (Date) value;
if ((startDateLine != null) && (getEndingDate() != null)
&& (startDateLine.compareTo(getEndingDate()) > 0)) {
((Datebox) comp).setValue(null);
throw new WrongValueException(comp,
_("must be lower than finish date"));
}
@ -155,6 +156,7 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
Date endingDate = (Date) value;
if ((endingDate != null) && (getStartingDate() != null)
&& (endingDate.compareTo(getStartingDate()) < 0)) {
((Datebox) comp).setValue(null);
throw new WrongValueException(comp,
_("must be greater than finish date"));
}