diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index b80860e8..7b605ef0 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -1681,7 +1681,8 @@ GO ========================================================================================================== */ Create Function [dbo].[vefn_SiblingAndChildrenItemsNewByWord](@DocVersionList VarChar(Max), @UnitPrefix VarChar(Max), @SearchString VarChar(Max), - @SearchStringx VarChar(Max), @StepTypeList VarChar(Max)) + @SearchStringx VarChar(Max), @StepTypeList VarChar(Max), + @includeLinks int, @includeRtfFormatting int , @includeSpecialCharacters int) Returns @SiblingAndChildren Table ( ILastChanged VarBinary(8), @@ -1888,8 +1889,11 @@ Begin join dbo.vefn_DocVersionSplit(@DocVersionList) dv on dv.VersionID = zi.VersionID left join Entries e with (NoLock) on e.ContentID = zi.ContentID left join Documents d with (NoLock) on d.DocID = e.DocID - Where (@TextPrefix + zi.[Text] + @TextSuffix like @SearchString Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchString - Or @TextPrefix + zi.[Text] + @TextSuffix like @SearchStringx Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchStringx) + -- B2022-082: use the vefn_RemoveExtraText to get rid of rtf commands before comparing text + Where (dbo.vefn_RemoveExtraText(@TextPrefix + zi.[Text] + @TextSuffix, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) + like @SearchString Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchString + Or dbo.vefn_RemoveExtraText(@TextPrefix + zi.[Text] + @TextSuffix, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) + like @SearchStringx Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchStringx) And (IsNull(@StepTypeList,'') = '' or (dbo.vefn_AllSections(zi.CType) in (Select ID from dbo.vefn_SplitInt(@StepTypeList,',')))) Option (Recompile, MaxRecursion 10000); @@ -6329,6 +6333,9 @@ IF @includeLink < 2 -- Remove Comments if(@includeRtfFormatting=0) -- Remove Rtf Formatting BEGIN + -- B2022-082: underline/bold of word removes space between 2 words so was not finding cases + SET @text = Replace(@text, '\ulnone\b0 ', ''); + SET @text = Replace(@text, '\b0\ulnone ', ''); SET @text = Replace(@text, '\b0 ', ''); SET @text = Replace(@text, '\b ', ''); SET @text = Replace(@text, '\ulnone ', ''); @@ -15956,7 +15963,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Order By z.DvPath Asc Option (Recompile); @@ -16004,7 +16011,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Where (@TextPrefix + z.Text + @TextSuffix Collate SQL_Latin1_General_CP1_CS_AS like @SearchString or @TextPrefix + z.Text + @TextSuffix Collate SQL_Latin1_General_CP1_CS_AS like @SearchStringx or Replace(z.DocAscii,nChar(176),'\''B0') Collate SQL_Latin1_General_CP1_CS_AS like @SearchString @@ -16063,7 +16070,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Where (dbo.vefn_RemoveExtraText(@TextPrefix + z.Text + @TextSuffix, @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CI_AS like @SearchString Or dbo.vefn_RemoveExtraText(@TextPrefix + z.Text + @TextSuffix, @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CI_AS like @SearchStringx Or Replace(z.DocAscii, nChar(176), '\''B0') Collate SQL_Latin1_General_CP1_CI_AS like @SearchString @@ -16117,7 +16124,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Where (dbo.vefn_RemoveExtraText(Replace(@TextPrefix + z.Text + @TextSuffix,'\''b0', '\''B0'), @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CS_AS like Replace(@SearchString,'\''b0', '\''B0') Or dbo.vefn_RemoveExtraText(Replace(@TextPrefix + z.Text + @TextSuffix,'\''b0', '\''B0'), @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CS_AS like Replace(@SearchStringx,'\''b0', '\''B0') Or Replace(z.DocAscii,nChar(176),'\''B0') Collate SQL_Latin1_General_CP1_CS_AS like @SearchString @@ -20979,8 +20986,8 @@ BEGIN TRY -- Try Block DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '07/27/2022 1:20 PM' - set @RevDescription = 'B2022-083: Support Conditional RO Values (v2.1)' + set @RevDate = '07/29/2022 9:00 AM' + set @RevDescription = 'B2022-082: Search not finding occurrences that use bold and underline' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription diff --git a/PROMS/VEPROMS User Interface/PROMSFixes.Sql b/PROMS/VEPROMS User Interface/PROMSFixes.Sql index b80860e8..7b605ef0 100644 --- a/PROMS/VEPROMS User Interface/PROMSFixes.Sql +++ b/PROMS/VEPROMS User Interface/PROMSFixes.Sql @@ -1681,7 +1681,8 @@ GO ========================================================================================================== */ Create Function [dbo].[vefn_SiblingAndChildrenItemsNewByWord](@DocVersionList VarChar(Max), @UnitPrefix VarChar(Max), @SearchString VarChar(Max), - @SearchStringx VarChar(Max), @StepTypeList VarChar(Max)) + @SearchStringx VarChar(Max), @StepTypeList VarChar(Max), + @includeLinks int, @includeRtfFormatting int , @includeSpecialCharacters int) Returns @SiblingAndChildren Table ( ILastChanged VarBinary(8), @@ -1888,8 +1889,11 @@ Begin join dbo.vefn_DocVersionSplit(@DocVersionList) dv on dv.VersionID = zi.VersionID left join Entries e with (NoLock) on e.ContentID = zi.ContentID left join Documents d with (NoLock) on d.DocID = e.DocID - Where (@TextPrefix + zi.[Text] + @TextSuffix like @SearchString Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchString - Or @TextPrefix + zi.[Text] + @TextSuffix like @SearchStringx Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchStringx) + -- B2022-082: use the vefn_RemoveExtraText to get rid of rtf commands before comparing text + Where (dbo.vefn_RemoveExtraText(@TextPrefix + zi.[Text] + @TextSuffix, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) + like @SearchString Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchString + Or dbo.vefn_RemoveExtraText(@TextPrefix + zi.[Text] + @TextSuffix, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) + like @SearchStringx Or Replace(d.DocAscii, nChar(176), '\''B0') like @SearchStringx) And (IsNull(@StepTypeList,'') = '' or (dbo.vefn_AllSections(zi.CType) in (Select ID from dbo.vefn_SplitInt(@StepTypeList,',')))) Option (Recompile, MaxRecursion 10000); @@ -6329,6 +6333,9 @@ IF @includeLink < 2 -- Remove Comments if(@includeRtfFormatting=0) -- Remove Rtf Formatting BEGIN + -- B2022-082: underline/bold of word removes space between 2 words so was not finding cases + SET @text = Replace(@text, '\ulnone\b0 ', ''); + SET @text = Replace(@text, '\b0\ulnone ', ''); SET @text = Replace(@text, '\b0 ', ''); SET @text = Replace(@text, '\b ', ''); SET @text = Replace(@text, '\ulnone ', ''); @@ -15956,7 +15963,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Order By z.DvPath Asc Option (Recompile); @@ -16004,7 +16011,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Where (@TextPrefix + z.Text + @TextSuffix Collate SQL_Latin1_General_CP1_CS_AS like @SearchString or @TextPrefix + z.Text + @TextSuffix Collate SQL_Latin1_General_CP1_CS_AS like @SearchStringx or Replace(z.DocAscii,nChar(176),'\''B0') Collate SQL_Latin1_General_CP1_CS_AS like @SearchString @@ -16063,7 +16070,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Where (dbo.vefn_RemoveExtraText(@TextPrefix + z.Text + @TextSuffix, @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CI_AS like @SearchString Or dbo.vefn_RemoveExtraText(@TextPrefix + z.Text + @TextSuffix, @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CI_AS like @SearchStringx Or Replace(z.DocAscii, nChar(176), '\''B0') Collate SQL_Latin1_General_CP1_CI_AS like @SearchString @@ -16117,7 +16124,7 @@ Begin (Select Count(1) From RoUsages ru with (NoLock) Where ru.ContentID = z.ContentID) as 'RoUsageCount', (Select Count(1) From Transitions t with (NoLock) Where t.FromID = z.ContentID) as 'TransitionCount', (Select Count(1) From ZContents zc with (NoLock) Where zc.ContentID = z.ContentID) as 'ZContentCount' - From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList) z + From dbo.vefn_SiblingAndChildrenItemsNewByWord(@DocVersionList, @UnitPrefix, @SearchString, @SearchStringx, @StepTypeList, @includeLinks, @includeRtfFormatting, @includeSpecialCharacters) z Where (dbo.vefn_RemoveExtraText(Replace(@TextPrefix + z.Text + @TextSuffix,'\''b0', '\''B0'), @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CS_AS like Replace(@SearchString,'\''b0', '\''B0') Or dbo.vefn_RemoveExtraText(Replace(@TextPrefix + z.Text + @TextSuffix,'\''b0', '\''B0'), @IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) Collate SQL_Latin1_General_CP1_CS_AS like Replace(@SearchStringx,'\''b0', '\''B0') Or Replace(z.DocAscii,nChar(176),'\''B0') Collate SQL_Latin1_General_CP1_CS_AS like @SearchString @@ -20979,8 +20986,8 @@ BEGIN TRY -- Try Block DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '07/27/2022 1:20 PM' - set @RevDescription = 'B2022-083: Support Conditional RO Values (v2.1)' + set @RevDate = '07/29/2022 9:00 AM' + set @RevDescription = 'B2022-082: Search not finding occurrences that use bold and underline' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 1d8c9384..fc52d69f 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2965,6 +2965,9 @@ namespace VEPROMS.CSLA.Library public static string StripRtfFormatting(string rtf) { string retval = rtf; + // B2022-082: underline/bold of word removes space between 2 words in DisplayText + retval = Regex.Replace(retval, @"\\ulnone\\b0 ?", ""); + retval = Regex.Replace(retval, @"\\b0\\ulnone ?", ""); retval = Regex.Replace(retval, @"\\b0 ?", ""); retval = Regex.Replace(retval, @"\\b ?", ""); retval = Regex.Replace(retval, @"\\ulnone ?", "");