B2022-098: ROs not being resolved in Word Sections

This commit is contained in:
Jake
2022-08-16 15:02:30 +00:00
parent 9bdaebadfc
commit ac8e8432b7
10 changed files with 913 additions and 302 deletions

View File

@@ -21026,6 +21026,235 @@ GO
==========================================================================================================
*/
/*
==========================================================================================================
Start: B2022-088: [JPR] Find Doc Ro button not working in Word Sections
B2022-098: [JPR] ROs not being resolved in Word Sections
==========================================================================================================
*/
IF EXISTS (Select * From dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[vesp_RofstDataGetChildByAccPageID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP Procedure [dbo].[vesp_RofstDataGetChildByAccPageID];
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description: Check if the AccPageID passed in has a specific Return Value Type Extension (.A, .B, .C, etc.)
If so, then strip off the return value specific extension to get the BaseAccPageID for the lookup.
Use the BaseAccPageID to lookup the BaseRoid, then use the Roid to lookup the Ro Child Object
Note** Using the AccPageID to first lookup the roid, then using the roid to lookup the data is
significantly faster than directly looking up the data using the AccPageID because of the indexes
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetChildByAccPageID]
(
@RofstID int,
@AccPageID VarChar(50)
)
With Execute as Owner
As
Begin
Declare @BaseAccPageID VarChar(Max);
Declare @BaseRoid VarChar(Max);
-- Check if AccPageID has a valid extension
If ((PatIndex('%.[A-Z]', @AccPageID) > 0) And ((Select Count(1) From vwRofstData_RofstBaseRoids Where BaseAccPageID = @AccPageID) <= 0))
Set @BaseAccPageID = Left(@AccPageID, Len(@AccPageID)-2);
Else
Set @BaseAccPageID = @AccPageID;
-- Use the AccPageID to get the BaseRoid
Select @BaseRoid = rb.BaseRoid
From vwRofstData_RofstBaseRoids rb
Where rb.RofstID = @RofstID
And rb.BaseAccPageID = @BaseAccPageID;
-- Then use the BaseRoid to lookup the Ro Child Object
Select rc.ROFstID,
rc.dbiID,
rc.ID,
rc.ParentID,
rc.[type],
rc.title,
rc.roid,
rc.appid,
rc.[value],
rc.AccPageID
From vwRofstData_RofstChildren rc
Where rc.RofstID = @RofstID?
And rc.roid = @BaseRoid;
Return;
End
GO
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_RofstDataGetChildByAccPageID] Succeeded'
ELSE PRINT 'Procedure Creation: [vesp_RofstDataGetChildByAccPageID] Error on Creation'
GO
IF EXISTS (Select * From dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[vesp_RofstDataGetBaseAccPageKeys]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP Procedure [dbo].[vesp_RofstDataGetBaseAccPageKeys];
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************?
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 08/11/2022
Description: Gets all the Base AccPageKeys that end with a "." period followed by an Alpha Character (A through Z)
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetBaseAccPageKeys]
(
@RofstID int
)
With Execute as Owner
As
Begin
Select BaseAccPageID
From vwRofstData_RofstBaseRoids
Where BaseAccPageID like '%.[A-Z]';
Return;
End
GO
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_RofstDataGetBaseAccPageKeys] Succeeded'
ELSE PRINT 'Procedure Creation: [vesp_RofstDataGetBaseAccPageKeys] Error on Creation'
GO
If Exists(Select * From sys.objects Where type = 'FN' And object_id = OBJECT_ID('[dbo].[vefn_RofstDataReplaceLegacyTagsWithDefaults]'))
Drop Function [dbo].[vefn_RofstDataReplaceLegacyTagsWithDefaults];
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==========================================================================================
-- Author: Jake Ropar
-- Create Date: 06/21/2022
-- Description: Replaces any legacy applicability tags with the default value
-- ==========================================================================================
CREATE FUNCTION [dbo].[vefn_RofstDataReplaceLegacyTagsWithDefaults](@Values VarChar(Max)) Returns VarChar(Max)
WITH EXECUTE AS OWNER
AS
BEGIN
Declare @RetVal VarChar(Max) = '';
Declare @DefaultValue VarChar(Max) = '';
Declare @StartTagIndex Int;
Declare @EndTagIndex Int;
Declare @StartTagValue VarChar(Max);
Declare @StartValIndex Int;
Declare @EndValIndex Int;
Declare @TagName VarChar(Max);
Declare @LegacyTagNames VarChar(Max) = 'U-ID,U-NUMBER,U-NAME,U-TEXT,U-OTHERID,U-OTHERNUMBER,U-OTHERNAME,U-OTHERTEXT';
-- Make Sure all tag instances are upper case & Remove any internal spaces
Set @RetVal = dbo.vefn_RofstDataCleanUnitInfoTags(@Values, 0);
-- Remove any instances of double "}" that have a spaces between them ex: "} }"
Set @RetVal = Replace(@RetVal, '} }', '}}');
Declare LegacyTags_Cursor Cursor Fast_Forward For
Select '{' + x.ListValue + '{' as 'TagName'
From [dbo].[vefn_ParseStringListToTable](@LegacyTagNames, ',') x
Open LegacyTags_Cursor
Fetch Next From LegacyTags_Cursor Into @TagName
While (@@FETCH_STATUS = 0)
Begin
-- Get Start/End Index of Tag
Set @StartTagIndex = PatIndex('%' + @TagName + '%', @RetVal);
Set @EndTagIndex = PatIndex('%}}%', @RetVal);
While (@StartTagIndex > 0)
Begin
Set @StartTagValue = SubString(@RetVal, @StartTagIndex, (@EndTagIndex - @StartTagIndex) + 2);
Set @StartValIndex = PatIndex('%=%', @StartTagValue);
Set @EndValIndex = PatIndex('%}%', @StartTagValue);
Set @DefaultValue = SubString(@StartTagValue, @StartValIndex + 1, (@EndValIndex - @StartValIndex) - 1);
Set @RetVal = Replace(@RetVal, @StartTagValue, @DefaultValue);
Set @StartTagIndex = PatIndex('%' + @TagName + '%', @RetVal);
Set @EndTagIndex = PatIndex('%}}%', @RetVal);
End -- While (@StartTagIndex > 0)
Fetch Next From LegacyTags_Cursor Into @TagName
End
Close LegacyTags_Cursor;
Deallocate LegacyTags_Cursor;
Return @RetVal;
END
Go
IF (@@Error = 0) PRINT 'Procedure Creation: [vefn_RofstDataReplaceLegacyTagsWithDefaults] Succeeded'
ELSE PRINT 'Procedure Creation: [vefn_RofstDataReplaceLegacyTagsWithDefaults] Error on Creation'
GO
/*
==========================================================================================================
End: B2022-088: [JPR] Find Doc Ro button not working in Word Sections
B2022-098: [JPR] ROs not being resolved in Word Sections
==========================================================================================================
*/
-----------------------------------------------------------------------------
/*
---------------------------------------------------------------------------
@@ -21060,8 +21289,8 @@ BEGIN TRY -- Try Block
DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255)
set @RevDate = '08/03/2022 9:00 AM'
set @RevDescription = 'B2022-049 Unlink single procedure for enhanced (if data got corrupted) '
set @RevDate = '08/16/2022 10:00 AM'
set @RevDescription = 'B2022-088: [JPR] Find Doc Ro button not working in Word Sections & B2022-098: [JPR] ROs not being resolved in Word Sections '
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription

View File

@@ -4116,16 +4116,12 @@ namespace VEPROMS
ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
// B2022-088: Find Doc Ro button not working in Word Sections
string roidBase = string.Empty;
string roidExt = string.Empty;
string roid16 = ROFSTLookup.FormatRoidKey(roid, ref roidBase, ref roidExt, true);
ROFSTLookup.rochild roc = lookup.GetRoChild(roid16);
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
// B2022-098: [JPR] ROs not being resolved in Word Sections
roid = ROFSTLookup.FormatRoidKey(roid, true);
ROFSTLookup.rochild roc = lookup.GetRoChild(roid);
string roval = roc.value;
//string roval = (roc.ID < 0 || string.IsNullOrEmpty(roc.value)) ? "?" : roc.value;
if (roval == "?")
{
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));