Bug #1289: Added subcontractor name to tasks when showing resources is enabled
The name of the subcontractors are not being displayed when the container is collapsed. The expected behaviour also might consider painting the parent node differently when it only contains subcontracted elements. FEA: ItEr76S04BugFixing
This commit is contained in:
parent
ad4849881f
commit
ff2f2298cf
3 changed files with 31 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ import org.joda.time.LocalDate;
|
|||
import org.libreplan.business.calendars.entities.AvailabilityTimeLine;
|
||||
import org.libreplan.business.calendars.entities.ICalendar;
|
||||
import org.libreplan.business.calendars.entities.SameWorkHoursEveryDay;
|
||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.libreplan.business.orders.entities.AggregatedHoursGroup;
|
||||
import org.libreplan.business.orders.entities.HoursGroup;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
|
|
@ -888,6 +889,10 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
|
|||
return subcontractedTaskData;
|
||||
}
|
||||
|
||||
public ExternalCompany getSubcontractedCompany() {
|
||||
return subcontractedTaskData.getExternalCompany();
|
||||
}
|
||||
|
||||
public void removeAllSatisfiedResourceAllocations() {
|
||||
Set<ResourceAllocation<?>> resourceAllocations = getSatisfiedResourceAllocations();
|
||||
for (ResourceAllocation<?> resourceAllocation : resourceAllocations) {
|
||||
|
|
@ -907,6 +912,10 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
|
|||
return (subcontractedTaskData != null);
|
||||
}
|
||||
|
||||
public String getSubcontractionName() {
|
||||
return subcontractedTaskData.getExternalCompany().getName();
|
||||
}
|
||||
|
||||
public boolean isSubcontractedAndWasAlreadySent() {
|
||||
return (subcontractedTaskData != null)
|
||||
&& (!subcontractedTaskData.getState()
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import org.joda.time.LocalDate;
|
|||
import org.libreplan.business.calendars.entities.BaseCalendar;
|
||||
import org.libreplan.business.common.BaseEntity;
|
||||
import org.libreplan.business.common.entities.ProgressType;
|
||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.orders.entities.OrderStatusEnum;
|
||||
|
|
@ -569,6 +570,10 @@ public abstract class TaskElement extends BaseEntity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public String getSubcontractionName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean isSubcontractedAndWasAlreadySent() {
|
||||
// Just Task could be subcontracted
|
||||
return false;
|
||||
|
|
@ -747,4 +752,8 @@ public abstract class TaskElement extends BaseEntity {
|
|||
return (this.getParent() == null);
|
||||
}
|
||||
|
||||
public ExternalCompany getSubcontractedCompany() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
* Copyright (C) 2010-2011 Igalia, S.L.
|
||||
* Copyright (C) 2010-2012 Igalia, S.L.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
@ -57,8 +57,10 @@ import org.libreplan.business.common.IAdHocTransactionService;
|
|||
import org.libreplan.business.common.IOnTransaction;
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.entities.ProgressType;
|
||||
import org.libreplan.business.externalcompanies.daos.IExternalCompanyDAO;
|
||||
import org.libreplan.business.labels.entities.Label;
|
||||
import org.libreplan.business.orders.daos.IOrderElementDAO;
|
||||
import org.libreplan.business.orders.daos.OrderElementDAO;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.orders.entities.OrderStatusEnum;
|
||||
|
|
@ -269,6 +271,9 @@ public class TaskElementAdapter {
|
|||
@Autowired
|
||||
private IResourceAllocationDAO resourceAllocationDAO;
|
||||
|
||||
@Autowired
|
||||
private IExternalCompanyDAO externalCompanyDAO;
|
||||
|
||||
@Autowired
|
||||
private IResourcesSearcher searcher;
|
||||
|
||||
|
|
@ -821,6 +826,10 @@ public class TaskElementAdapter {
|
|||
public String execute() {
|
||||
orderElementDAO.reattach(taskElement
|
||||
.getOrderElement());
|
||||
if (taskElement.isSubcontracted()) {
|
||||
externalCompanyDAO.reattach(taskElement
|
||||
.getSubcontractedCompany());
|
||||
}
|
||||
return buildResourcesText();
|
||||
}
|
||||
});
|
||||
|
|
@ -883,6 +892,9 @@ public class TaskElementAdapter {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (taskElement.isSubcontracted()) {
|
||||
result.add(taskElement.getSubcontractionName());
|
||||
}
|
||||
Collections.sort(result);
|
||||
return StringUtils.join(result, ", ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue