diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java index c4da746aa2..f324df03db 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java @@ -587,6 +587,8 @@ public class HoldServiceImpl extends ServiceBaseImpl addFrozenAspect(nodeRef, props); // Link the record to the hold + //set in transaction cache in order not to trigger update policy when adding the association + transactionalResourceHelper.getSet("frozen").add(nodeRef); nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); // audit item being added to the hold diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java index 191b170d59..a21ecb4184 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java @@ -245,4 +245,40 @@ public class AddActiveContentToHoldTest extends BaseRMTestCase } }); } + + /** + * Given active content on hold + * When I try to add content to another hold + * And I have file permission on the other hold + * And I have the appropriate capability to add to hold + * Then the active content is contained within both holds + * And the active content remains frozen + */ + public void testAddDocumentToAnotherHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef hold2; + + public void given() + { + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + holdService.addToHold(hold, dmDocument); + } + + public void when() + { + holdService.addToHold(hold2, dmDocument); + } + + public void then() + { + assertTrue(freezeService.isFrozen(dmDocument)); + assertTrue(holdService.heldBy(dmDocument, true).contains(hold)); + assertTrue(holdService.heldBy(dmDocument, true).contains(hold2)); + } + }); + } }