ItEr58S17AsignacionConsolidacion: adds constraints to the advance consolidation.
the advance consolidation is read only if the task has got some limiting resources allocations. it can not consolidate advances if the task is subcontrated or if the task has not got any resources allocations.
This commit is contained in:
parent
bac99b74da
commit
4561821b1a
7 changed files with 62 additions and 4 deletions
|
|
@ -330,6 +330,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
tbResourceAllocation.setSelected(true);
|
||||
newAllocationSelector.clearAll();
|
||||
Util.reloadBindings(allocationsGrid);
|
||||
reloadAdvanceConsolidationTab();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -664,6 +665,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
private void removeAllocation(AllocationRow row) {
|
||||
allocationRows.remove(row);
|
||||
Util.reloadBindings(allocationsGrid);
|
||||
reloadAdvanceConsolidationTab();
|
||||
}
|
||||
|
||||
private Button appendDeleteButton(Row row) {
|
||||
|
|
@ -701,4 +703,12 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
resourceAllocationModel.setStartDate(date);
|
||||
}
|
||||
|
||||
public boolean hasResourceAllocations() {
|
||||
return ((getResourceAllocations().size() > 1));
|
||||
}
|
||||
|
||||
private void reloadAdvanceConsolidationTab() {
|
||||
Util.reloadBindings(editTaskWindow
|
||||
.getFellowIfAny("advanceConsolidationTab"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public class AdvanceConsolidationController extends GenericForwardComposer {
|
|||
|
||||
public void reloadAdvanceGrid() {
|
||||
advanceConsolidationModel.initLastConsolidatedDate();
|
||||
advanceConsolidationModel.setReadOnlyConsolidations();
|
||||
Util.reloadBindings(advancesGrid);
|
||||
}
|
||||
|
||||
|
|
@ -121,4 +122,10 @@ public class AdvanceConsolidationController extends GenericForwardComposer {
|
|||
return advanceConsolidationModel.infoMessages();
|
||||
}
|
||||
|
||||
public String getReadOnlySclass() {
|
||||
if (advanceConsolidationModel.hasLimitingResourceAllocation()) {
|
||||
return "readonly";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public class AdvanceConsolidationDTO {
|
|||
|
||||
public static Date lastConsolidatedAndSavedDate;
|
||||
|
||||
private static boolean allReadOnly = false;
|
||||
|
||||
private AdvanceMeasurement advanceMeasurement;
|
||||
|
||||
private ConsolidatedValue consolidatedValue;
|
||||
|
|
@ -138,8 +140,9 @@ public class AdvanceConsolidationDTO {
|
|||
}
|
||||
|
||||
public Boolean canNotBeConsolidated() {
|
||||
if ((isConsolidated()) && (consolidatedValue != null)
|
||||
&& (!consolidatedValue.isNewObject())) {
|
||||
if (isAllReadOnly()
|
||||
|| ((isConsolidated()) && (consolidatedValue != null) && (!consolidatedValue
|
||||
.isNewObject()))) {
|
||||
return true;
|
||||
}
|
||||
if (lastConsolidatedDate != null) {
|
||||
|
|
@ -172,4 +175,12 @@ public class AdvanceConsolidationDTO {
|
|||
return value;
|
||||
}
|
||||
|
||||
public static void setAllReadOnly(boolean allReadOnly) {
|
||||
AdvanceConsolidationDTO.allReadOnly = allReadOnly;
|
||||
}
|
||||
|
||||
public static boolean isAllReadOnly() {
|
||||
return allReadOnly;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
createAdvanceConsolidationDTOs();
|
||||
initConsolidatedDates();
|
||||
addNonConsolidatedAdvances();
|
||||
setReadOnlyConsolidations();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +331,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleMessages() {
|
||||
return (getAdvances().size() == 0);
|
||||
return ((getAdvances().size() == 0) || (isSubcontrated()) || (!hasResourceAllocation()));
|
||||
}
|
||||
|
||||
private boolean advanceIsCalculated(){
|
||||
|
|
@ -338,6 +339,9 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
|
||||
public String infoMessages() {
|
||||
if (getAdvances().size() > 0) {
|
||||
return _("It is not allowed to consolidate advances.");
|
||||
}
|
||||
return _("There are not any assigned advance to current task");
|
||||
}
|
||||
|
||||
|
|
@ -353,4 +357,22 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
return new ArrayList<AdvanceConsolidationDTO>();
|
||||
}
|
||||
|
||||
private boolean hasResourceAllocation() {
|
||||
return ((task != null) && (task.hasResourceAllocations()));
|
||||
}
|
||||
|
||||
private boolean isSubcontrated() {
|
||||
return ((task != null) && (task.isSubcontracted()));
|
||||
}
|
||||
|
||||
public boolean hasLimitingResourceAllocation() {
|
||||
return ((task != null) && (task.hasLimitedResourceAllocation()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadOnlyConsolidations() {
|
||||
// set all advance consolidations as read only
|
||||
AdvanceConsolidationDTO.setAllReadOnly(hasLimitingResourceAllocation());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ public interface IAdvanceConsolidationModel {
|
|||
|
||||
void initLastConsolidatedDate();
|
||||
|
||||
boolean hasLimitingResourceAllocation();
|
||||
|
||||
void setReadOnlyConsolidations();
|
||||
|
||||
boolean isVisibleAdvances();
|
||||
|
||||
boolean isVisibleMessages();
|
||||
|
|
|
|||
|
|
@ -1342,3 +1342,6 @@ tr.z-tree-row-seld .z-row-cnt {
|
|||
background-color: #CCCCCC;
|
||||
}
|
||||
|
||||
.readonly .z-grid-body .z-row-inner {
|
||||
background-color: #CCCCCC;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@
|
|||
model="@{advanceController.advances}"
|
||||
mold="paging"
|
||||
pageSize="10"
|
||||
fixedLayout="true" >
|
||||
fixedLayout="true"
|
||||
sclass="@{advanceController.readOnlySclass}">
|
||||
<columns>
|
||||
<column label="${i18n:_('Value')}" width="150px" align="center"/>
|
||||
<column label="${i18n:_('Date')}" width="150px" align="center"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue