From 2a1e7d3db6b456749cdca9ba073ab4b8e25a231b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Thu, 10 May 2012 12:09:00 +0200 Subject: [PATCH] Bug #1442: Fix regression. FEA: ItEr76S04BugFixing --- .../libreplan/business/orders/entities/OrderElement.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java index ba21c7f15..484e2d712 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java @@ -299,7 +299,7 @@ public abstract class OrderElement extends IntegrationEntity implements //we have to remove the TaskSource which contains a TaskGroup instead of TaskElement removeTaskSource(result); } - if(currentTaskSourceIsNotTheSame()) { + if (hadATaskSource() && currentTaskSourceIsNotTheSame()) { //this element was unscheduled and then scheduled again. Its TaskSource has //been recreated but we have to remove the old one. if(!getParent().currentTaskSourceIsNotTheSame()) { @@ -316,7 +316,7 @@ public abstract class OrderElement extends IntegrationEntity implements if (wasASchedulingPoint()) { result.add(taskSourceRemoval()); } - if(currentTaskSourceIsNotTheSame()) { + if (hadATaskSource() && currentTaskSourceIsNotTheSame()) { //all the children of this element were unscheduled and then scheduled again, //its TaskSource has been recreated but we have to remove the old one. if(getParent() == null || !getParent().currentTaskSourceIsNotTheSame()) { @@ -356,6 +356,10 @@ public abstract class OrderElement extends IntegrationEntity implements return getOnDBTaskSource() != getTaskSource(); } + protected boolean hadATaskSource() { + return getOnDBTaskSource() != null; + } + private List childrenSynchronizations() { List childrenOfGroup = new ArrayList(); for (OrderElement orderElement : getSomewhatScheduledOrderElements()) {