diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/IMoneyCostCalculator.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/IMoneyCostCalculator.java index 40fe17d20..2f6f21230 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/IMoneyCostCalculator.java +++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/IMoneyCostCalculator.java @@ -38,7 +38,11 @@ public interface IMoneyCostCalculator { * following formula:
* Sum of all the hours devoted to a task multiplied by the cost of * each hour according to these parameters (type of hour, cost category of - * the resource, date of the work report) + * the resource, date of the work report)
+ * + * If there is not relationship between resource and type of hour through + * the cost categories, the price used is the default one for the type of + * hour. * * @param The * {@link OrderElement} to calculate the money cost diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/MoneyCostCalculator.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/MoneyCostCalculator.java index 09d1322ec..9afd0e21d 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/MoneyCostCalculator.java +++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/MoneyCostCalculator.java @@ -66,6 +66,13 @@ public class MoneyCostCalculator implements IMoneyCostCalculator { workReportLine.getResource(), workReportLine.getLocalDate(), workReportLine.getTypeOfWorkHours()); + + // If cost undefined via CostCategory get it from type + if (priceCost == null) { + priceCost = workReportLine.getTypeOfWorkHours() + .getDefaultPrice(); + } + BigDecimal cost = priceCost.multiply(workReportLine.getEffort() .toHoursAsDecimalWithScale(2)); result = result.add(cost);