Added sql procedure ‘ClearCBOverrideForProcedure’ to clear content/config’s Step CBOverride fields for an input itemID (that is a procedure), to fix B2015-039
B2015-039: Clear Change Bar Overrides for approval
This commit is contained in:
@@ -11352,4 +11352,64 @@ END CATCH
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_PurgeDisconnectedData Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_PurgeDisconnectedData Error on Creation'
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'ClearCBOverrideForProcedure') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE ClearCBOverrideForProcedure;
|
||||
GO
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2016 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
|
||||
CREATE PROCEDURE [dbo].ClearCBOverrideForProcedure
|
||||
(
|
||||
@ItemID int=null
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
begin
|
||||
DECLARE @CBConfigs TABLE
|
||||
(
|
||||
[ContentID] int,
|
||||
xConfig xml
|
||||
)
|
||||
insert into @CBConfigs select ContentID, cast(Config as xml) xConfig
|
||||
from Contents where config like '%CBOverride%' and contentid in (select icontentid from vefn_tblchilditems(@ItemID,@ItemID,0))
|
||||
|
||||
Update @CBConfigs Set xConfig.modify('delete //@CBOverride') From @CBConfigs
|
||||
Update @CBConfigs Set xConfig.modify('delete //Step[not(node())and not(./@*)]') From @CBConfigs
|
||||
|
||||
UPDATE CC SET config = cast(xconfig as varchar(max))
|
||||
FROM CONTENTS CC
|
||||
Join @CBConfigs CB on cc.contentid = cb.contentid
|
||||
where cc.contentid in (select contentid from @CBConfigs)
|
||||
|
||||
SELECT
|
||||
[ContentID],
|
||||
[Number],
|
||||
[Text],
|
||||
[Type],
|
||||
[FormatID],
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=[Contents].[ContentID]) [TransitionCount],
|
||||
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=[Contents].[ContentID]) [ZContentCount]
|
||||
FROM [Contents]
|
||||
where contentid in (select contentid from @CBConfigs)
|
||||
end
|
||||
go
|
||||
|
||||
-- Display the status of ClearCBOverrideForProcedure
|
||||
IF (@@Error = 0) PRINT 'StoredProcedure [ClearCBOverrideForProcedure] Succeeded'
|
||||
ELSE PRINT 'StoredProcedure [ClearCBOverrideForProcedure] Error on Creation'
|
||||
go
|
||||
PRINT '20160126 Improved performance for checkouts'
|
||||
|
Reference in New Issue
Block a user