From 2c587dd84879ad04381caa3be1c191b18e1ec53f Mon Sep 17 00:00:00 2001 From: Kathy Ruffing Date: Wed, 27 Mar 2024 10:06:37 -0400 Subject: [PATCH] B2024-018: enhanced linking with subsections --- PROMS/VEPROMS User Interface/PROMSFixes.Sql | 80 ++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS User Interface/PROMSFixes.Sql b/PROMS/VEPROMS User Interface/PROMSFixes.Sql index b85e31f3..d8640387 100644 --- a/PROMS/VEPROMS User Interface/PROMSFixes.Sql +++ b/PROMS/VEPROMS User Interface/PROMSFixes.Sql @@ -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