Bug #1366: Fix issue subtracting the value when you are removing work report lines
FEA: ItEr76S04BugFixing
This commit is contained in:
parent
e3e47b924c
commit
88c25ef47c
2 changed files with 21 additions and 5 deletions
|
|
@ -520,13 +520,21 @@ public class OrderElementDAO extends IntegrationEntityDAO<OrderElement>
|
|||
}
|
||||
|
||||
private void updateIndirectChargedEffortWithMap(
|
||||
Map<Long, EffortDuration> relationOrderElementIdAndIndirectChargedEffort)
|
||||
Map<Long, EffortDuration> relationOrderElementIdAndIndirectChargedEffort,
|
||||
boolean sum)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
for (Long id : relationOrderElementIdAndIndirectChargedEffort.keySet()) {
|
||||
OrderElement orderElement = find(id);
|
||||
orderElement.getSumChargedEffort().addIndirectChargedEffort(
|
||||
relationOrderElementIdAndIndirectChargedEffort.get(id));
|
||||
if (sum) {
|
||||
orderElement.getSumChargedEffort().addIndirectChargedEffort(
|
||||
relationOrderElementIdAndIndirectChargedEffort.get(id));
|
||||
} else {
|
||||
orderElement.getSumChargedEffort()
|
||||
.subtractIndirectChargedEffort(
|
||||
relationOrderElementIdAndIndirectChargedEffort
|
||||
.get(id));
|
||||
}
|
||||
save(orderElement);
|
||||
}
|
||||
}
|
||||
|
|
@ -540,7 +548,8 @@ public class OrderElementDAO extends IntegrationEntityDAO<OrderElement>
|
|||
updateRelatedSumChargedEffortWithDeletedWorkReportLine(line,
|
||||
relationOrderElementIdAndIndirectChargedEffort);
|
||||
}
|
||||
updateIndirectChargedEffortWithMap(relationOrderElementIdAndIndirectChargedEffort);
|
||||
updateIndirectChargedEffortWithMap(
|
||||
relationOrderElementIdAndIndirectChargedEffort, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -552,7 +561,8 @@ public class OrderElementDAO extends IntegrationEntityDAO<OrderElement>
|
|||
updateRelatedSumChargedEffortWithWorkReportLine(line,
|
||||
relationOrderElementIdAndIndirectChargedEffort);
|
||||
}
|
||||
updateIndirectChargedEffortWithMap(relationOrderElementIdAndIndirectChargedEffort);
|
||||
updateIndirectChargedEffortWithMap(
|
||||
relationOrderElementIdAndIndirectChargedEffort, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ public class SumChargedEffort extends BaseEntity {
|
|||
.plus(indirectChargedEffort);
|
||||
}
|
||||
|
||||
public void subtractIndirectChargedEffort(
|
||||
EffortDuration indirectChargedEffort) {
|
||||
this.indirectChargedEffort = this.indirectChargedEffort
|
||||
.minus(indirectChargedEffort);
|
||||
}
|
||||
|
||||
public EffortDuration getIndirectChargedEffort() {
|
||||
return indirectChargedEffort;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue