Merge pull request 'B2024-018: enhanced linking with subsections' (#281) from B2024-018 into Development
code review successful. OK to test.
This commit is contained in:
commit
95a39e5a12
@ -22148,8 +22148,84 @@ AS
|
||||
[Folders].[FormatID]=@FormatID
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListUnlinkedItems]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_ListUnlinkedItems];
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2024 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
/*
|
||||
==========================================================================================================
|
||||
Author: Kathy Ruffing
|
||||
Create Date: 03/27/2024
|
||||
Description: B2024-018: Gets list of procedures/sections/steps for possible enhanced linking
|
||||
==========================================================================================================
|
||||
*/
|
||||
Create Procedure[dbo].[vesp_ListUnlinkedItems]
|
||||
(
|
||||
@ItemID int,
|
||||
@EnhType int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @ParItemID int
|
||||
DECLARE @EItemID int
|
||||
set @EItemID = (select top 1 VIS.EItemID from vefn_AllSiblingItems(@ItemID)--Find All Siblings
|
||||
outer apply vefn_GetNewEnhancedData(ItemID,@EnhType) VIS -- That are Linked
|
||||
where EitemID is not null)
|
||||
|
||||
if @EItemID is null
|
||||
BEGIN
|
||||
select @EItemID = epp.ItemID
|
||||
from (select * from Parts where ItemID in(select itemID from vefn_AllSiblingItems(@ItemID)))SPP -- FindParent
|
||||
JOIN ITEMS SII ON sPP.ContentID = sII.ContentID -- Get Parent Content ID
|
||||
outer apply vefn_GetNewEnhancedData(SII.ItemID,@EnhType) VIS -- Get Enhanced ID for Parent
|
||||
JOIN ITEMS EII ON VIS.EItemID = EII.ItemID -- Get Enhanced Parent Content ID
|
||||
JOIN PARTS EPP ON EPP.ContentID = EII.ContentID and SPP.FromType = epp.FromType -- Get first Child
|
||||
END
|
||||
if @EItemID is null -- B2024-018: If not found at the current level, check at the parent level
|
||||
BEGIN
|
||||
|
||||
select @ParItemID = dbo.ve_getparentitem(@ItemID)
|
||||
select @EItemID = epp.ItemID
|
||||
from (select * from Parts where ItemID in(select itemID from vefn_AllSiblingItems(@ParItemID)))SPP -- FindParent
|
||||
JOIN ITEMS SII ON sPP.ContentID = sII.ContentID -- Get Parent Content ID
|
||||
outer apply vefn_GetNewEnhancedData(SII.ItemID,@EnhType) VIS -- Get Enhanced ID for Parent
|
||||
JOIN ITEMS EII ON VIS.EItemID = EII.ItemID -- Get Enhanced Parent Content ID
|
||||
JOIN PARTS EPP ON EPP.ContentID = EII.ContentID --and SPP.FromType = epp.FromType (had to remove types may be proc/sect)
|
||||
|
||||
END
|
||||
if @EItemID is null
|
||||
BEGIN
|
||||
select @EItemID = DV2.ItemID from (select *,cast(config as xml) xconfig from DocVersions
|
||||
where ItemID in(select itemID from vefn_AllSiblingItems(@ItemID))) SDV -- Source DocVersion
|
||||
cross apply (select * from vefn_GetEnhancedDocVersions(SDV.VersionID) where @EnhType = Type) EDV -- Enhanced DocVersion
|
||||
Join DocVersions DV2 ON DV2.VersionID = EDV.VersionID -- First Procedure
|
||||
END
|
||||
Select ItemID,PreviousID,II.ContentID,II.[DTS],II.[UserID],II.[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=[II].[ItemID]) [AnnotationCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=[II].[ItemID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Items] [Children] WHERE [Children].[PreviousID]=[II].[ItemID]) [NextCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=[II].[ItemID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=[II].[ItemID]) [Transition_RangeIDCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=[II].[ItemID]) [Transition_ToIDCount]
|
||||
from Items II
|
||||
Left Join Entries EE ON II.ContentID = EE.ContentID
|
||||
where ItemID In (select SIB.ItemID from vefn_AllSiblingItems(@EItemID) SIB
|
||||
outer apply vefn_GetNewEnhancedData(ItemID,0) VIE
|
||||
Where VIE.EItemID is null)
|
||||
and EE.ContentID is null
|
||||
END
|
||||
Go
|
||||
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_ListUnlinkedItems] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [vesp_ListUnlinkedItems] Error on Creation'
|
||||
GO
|
||||
-----------------------------------------------------------------------------
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
@ -22184,8 +22260,8 @@ BEGIN TRY -- Try Block
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
|
||||
set @RevDate = '10/03/2023 11:00 AM'
|
||||
set @RevDescription = 'C2023-017: Added logic to filter the format list when selecting a format to be applied to a section'
|
||||
set @RevDate = '03/27/2024 11:00 AM'
|
||||
set @RevDescription = 'B2024-018: Enhanced link issue with sub-sections in source but not in enhanced'
|
||||
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
|
Loading…
x
Reference in New Issue
Block a user