RM-6337 Fix visibility conditions for accession step.

This commit is contained in:
Roxana Lucanu-Ghetu
2018-05-28 22:48:57 +03:00
parent c2d0e2f86d
commit 1f6853b2ad
2 changed files with 22 additions and 6 deletions

View File

@@ -814,28 +814,43 @@ public class DispositionServiceImpl extends ServiceBaseImpl
// Get the disposition instructions
DispositionSchedule di = getDispositionSchedule(nodeRef);
NodeRef nextDa = getNextDispositionActionNodeRef(nodeRef);
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
DispositionAction nextDa = getNextDispositionAction(nodeRef);
if (di != null &&
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
nextDa != null)
{
Boolean combineSteps = null;
if (nextDa.getName().equals("accession"))
{
combineSteps = (Boolean)nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
}
// If it has an asOf date and it is greater than now the action is eligible
Date asOf = (Date)this.nodeService.getProperty(nextDa, PROP_DISPOSITION_AS_OF);
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
if (asOf != null &&
asOf.before(new Date()))
{
result = true;
if (combineSteps == null || !combineSteps)
{
return true;
}
}
else if(combineSteps != null && combineSteps)
{
return false;
}
if (!result)
if (!result || (result && combineSteps))
{
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa);
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
DispositionActionDefinition dad = da.getDispositionActionDefinition();
if (dad != null)
{
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa, ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef eventExecution = assoc.getChildRef();

View File

@@ -29,7 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.jscript.app;
import static org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel.READ_RECORDS;
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS;
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_RS_DISPOSITION_EVENTS;
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION;
import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED;
import java.util.ArrayList;
@@ -485,6 +485,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS
HashMap properties = ((HashMap) rmNodeValues.get("properties"));
properties.put("combineDispositionStepConditions", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS));
properties.put("incompleteDispositionEvent", details.getEventName());
properties.put("dispositionEventCombination", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT_COMBINATION));
break;
}
}