Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ const actions = <ActionTree<State, any>>{
await refreshNodeContents(payload.destinationNode, true).then(async x => {
await refreshNodeContents(state.editingTreeNode.parent, true).then(y => {
});
refreshHierarchyEdit(state);
state.rootNode.children.forEach(async (child) => {
if (child.nodeId != null) {
await refreshNodeContents(child, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ const actions = <ActionTree<State, any>>{
await refreshNodeContents(payload.destinationNode, true).then(async x => {
await refreshNodeContents(state.editingTreeNode.parent, true).then(y => {
});
refreshHierarchyEdit(state);
state.rootNode.children.forEach(async (child) => {
if (child.nodeId != null) {
await refreshNodeContents(child, false);
}
});
});
}).catch(e => {
state.inError = true;
Expand Down Expand Up @@ -492,8 +498,9 @@ const actions = <ActionTree<State, any>>{
state.inError = false;
contentStructureData.removeReferenceNode(payload.node.hierarchyEditDetailId).then(async response => {
await refreshNodeContents(payload.node.parent, false);
await refreshNodeContents(payload.node.parent.parent, false);
await refreshNodeIfMatchingNodeId(payload.node.parent, state.editingTreeNode.nodeId, state.editingTreeNode.hierarchyEditDetailId);
if (payload.node.parent.parent != null) {
await refreshNodeContents(payload.node.parent.parent, false);
}
}).catch(e => {
state.inError = true;
state.lastErrorMessage = "Error removing resource refrence.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
-- 20-05-2024 DB Added the creation of a new NodePath record for the moved node and update child nodes.
-- 29-05-2024 DB Clear the NodePathId for moved nodes. NodePaths can not be updated incase susequent references are made to the original path.
-- 07-08-2024 SA Remove all instance of the referenced path when moving a referenced folder
-- 23-08-2024 SA Moving a folder into a referenced folder should affect all instances of the referenced folder.
-------------------------------------------------------------------------------
CREATE PROCEDURE [hierarchy].[HierarchyEditMoveNode]
(
Expand Down Expand Up @@ -279,9 +280,51 @@ BEGIN
AND rrdv.Deleted = 0
AND hed.Deleted = 0

-- Remove all instance of the referenced path when moving a referenced folder
-- Remove all instance of the referenced path when moving a referenced folder

EXEC hierarchy.HierarchyEditRemoveNodeReferencesOnMoveNode @HierarchyEditDetailId,@UserId,@UserTimezoneOffset

-- Moving a folder into a referenced folder should affect all instances of the referenced folder.

DECLARE @CurrentNodeId INT,
@ReferenceHierarchyEditDetailId INT

SELECT @CurrentNodeId = hed.NodeId
FROM [hierarchy].[HierarchyEditDetail] hed
WHERE hed.Id = @MoveToHierarchyEditDetailId
AND HierarchyEditId = @HierarchyEditId

-- Declare the cursor

DECLARE NodeCursor CURSOR FOR
SELECT Id AS ReferenceHierarchyEditDetailId
FROM hierarchy.HierarchyEditDetail
WHERE NodeId = @CurrentNodeId
AND Id != @MoveToHierarchyEditDetailId
AND HierarchyEditId = @HierarchyEditId
AND deleted = 0
-- Open the cursor
OPEN NodeCursor;

-- Fetch the first row from the cursor
FETCH NEXT FROM NodeCursor
INTO @ReferenceHierarchyEditDetailId;

-- Loop until no more rows are returned
WHILE @@FETCH_STATUS = 0
BEGIN
-- Execute the script to add new folder references in all referenced instances
EXEC [hierarchy].[HierarchyEditReferenceNode] @HierarchyEditDetailId, @ReferenceHierarchyEditDetailId, @UserId,@UserTimezoneOffset

-- Fetch the next row from the cursor
FETCH NEXT FROM NodeCursor
INTO @ReferenceHierarchyEditDetailId;
END

-- Close and deallocate the cursor
CLOSE NodeCursor;
DEALLOCATE NodeCursor;

------------------------------------------------------------
-- Refresh HierarchyEditNodeResourceLookup
------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
--
-- 11-01-2022 KD Initial Revision.
-- 08-08-2024 SA Remove all instance of the referenced path when moving a referenced resource
-- 23-08-2024 SA Moving a resource into a referenced folder should affect all instances of the referenced folder
-------------------------------------------------------------------------------
CREATE PROCEDURE [hierarchy].[HierarchyEditMoveResource]
(
Expand Down Expand Up @@ -175,6 +176,48 @@ BEGIN
-- Remove all instance of the referenced path when moving a referenced resource

EXEC hierarchy.HierarchyEditRemoveResourceReferencesOnMoveResource @HierarchyEditDetailId,@ParentNodeId,@UserId,@UserTimezoneOffset

-- Moving a resource into a referenced folder should affect all instances of the referenced folder

DECLARE @CurrentNodeId INT,
@ReferenceHierarchyEditDetailId INT

SELECT @CurrentNodeId = hed.NodeId
FROM [hierarchy].[HierarchyEditDetail] hed
WHERE hed.Id = @MoveToHierarchyEditDetailId
AND HierarchyEditId = @HierarchyEditId

-- Declare the cursor

DECLARE NodeCursor CURSOR FOR
SELECT Id AS ReferenceHierarchyEditDetailId
FROM hierarchy.HierarchyEditDetail
WHERE NodeId = @CurrentNodeId
AND Id != @MoveToHierarchyEditDetailId
AND HierarchyEditId = @HierarchyEditId
AND deleted = 0
-- Open the cursor
OPEN NodeCursor;

-- Fetch the first row from the cursor
FETCH NEXT FROM NodeCursor
INTO @ReferenceHierarchyEditDetailId;

-- Loop until no more rows are returned
WHILE @@FETCH_STATUS = 0
BEGIN
-- Execute the update statement for the current row
EXEC [hierarchy].[HierarchyEditReferenceResource] @HierarchyEditDetailId, @ReferenceHierarchyEditDetailId, @UserId,@UserTimezoneOffset

-- Fetch the next row from the cursor
FETCH NEXT FROM NodeCursor
INTO @ReferenceHierarchyEditDetailId;
END

-- Close and deallocate the cursor
CLOSE NodeCursor;
DEALLOCATE NodeCursor;

------------------------------------------------------------
-- Refresh HierarchyEditNodeResourceLookup
------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
-- 03-06-2024 DB Publish NodePathDisplayVersion records.
-- 13-06-2024 DB Publish ResourceReferenceDisplayVersion records.
-- 26-07-2024 SA Remove references to be implemented
-- 27-08-2024 SA Moving a folder into a referenced folder should affect all instances of the referenced folder.[added
-- condition to avoid duplicate entries in to NodeLink table]
-------------------------------------------------------------------------------
CREATE PROCEDURE [hierarchy].[HierarchyEditPublish]
(
Expand Down Expand Up @@ -62,7 +64,7 @@ BEGIN
----------------------------------------------------------
-- Create new NodeLinks (arising from Create or Reference Node)
INSERT INTO [hierarchy].[NodeLink] ([ParentNodeId],[ChildNodeId],[DisplayOrder],[Deleted],[CreateUserId],[CreateDate],[AmendUserId],[AmendDate])
SELECT
SELECT DISTINCT
ParentNodeId,
NodeId AS ChildNodeId,
DisplayOrder,
Expand Down Expand Up @@ -230,7 +232,7 @@ BEGIN

-- Create moved NodeResource/s in their new locations
INSERT INTO [hierarchy].[NodeResource] ([NodeId],[ResourceId],[DisplayOrder],[VersionStatusId],[PublicationId],[Deleted],[CreateUserId],[CreateDate],[AmendUserId],[AmendDate])
SELECT ParentNodeId, ResourceId, DisplayOrder, 2 /* Published */, @PublicationId, 0, CreateUserId, CreateDate, AmendUserId, AmendDate
SELECT DISTINCT ParentNodeId, ResourceId, DisplayOrder, 2 /* Published */, @PublicationId, 0, @AmendUserId, @AmendDate, @AmendUserId, @AmendDate
FROM hierarchy.HierarchyEditDetail
WHERE HierarchyEditId = @HierarchyEditId
AND HierarchyEditDetailTypeId = 5 -- Node Resource
Expand Down Expand Up @@ -284,21 +286,6 @@ BEGIN
AND hed.Deleted = 0
AND nr.Deleted = 0

-- Update NodeResource Deleted status , if the reference is removed.
UPDATE
nr
SET
Deleted = 1,
AmendUserId = @AmendUserId,
AmendDate = @AmendDate
FROM
hierarchy.HierarchyEditDetail hed
INNER JOIN
hierarchy.NodeResource nr ON hed.NodeResourceId = nr.Id
WHERE
HierarchyEditId = @HierarchyEditId
AND hed.Deleted =1

----------------------------------------------------------
-- NodeVersion
----------------------------------------------------------
Expand Down