[Bug #1195] Fix bug

When using the owner scenario the allocations must also be switched to
the current scenario.  A lazy initialization exception is also avoided
reattaching the resources of the allocation to be removed.

FEA: ItEr75S04BugFixing
This commit is contained in:
Óscar González Fernández 2011-09-29 12:52:22 +02:00
parent 8bf213bd4e
commit 9687f23032
2 changed files with 8 additions and 0 deletions

View file

@ -404,6 +404,9 @@ public class AllocationRowsHandler {
for (AllocationRow each : currentRows) {
result.addAll(each.getAssociatedResources());
}
for (ResourceAllocation<?> each : requestedToRemove) {
result.addAll(each.getAssociatedResources());
}
return result;
}

View file

@ -304,6 +304,8 @@ public class PlanningStateCreator {
private IScenarioInfo buildScenarioInfo(Order orderReloaded) {
Scenario currentScenario = scenarioManager.getCurrent();
if (orderReloaded.isUsingTheOwnerScenario()) {
switchAllocationsToScenario(currentScenario,
orderReloaded.getAssociatedTaskElement());
return new UsingOwnerScenario(currentScenario, orderReloaded);
}
final List<DayAssignment> previousAssignments = orderReloaded
@ -323,6 +325,9 @@ public class PlanningStateCreator {
private static void switchAllocationsToScenario(Scenario scenario,
TaskElement task) {
if (task == null) {
return;
}
for (ResourceAllocation<?> each : task.getAllResourceAllocations()) {
each.switchToScenario(scenario);
}