Add option to fix all approval databases at once
Added Print Statements Corrected RestoreDeletedItem
This commit is contained in:
@@ -163,9 +163,13 @@ BEGIN CATCH -- Catch Block
|
||||
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: PasteItemReplace Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: PasteItemReplace Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: UserDefinedFunction [dbo].[vefn_ChronologyReport] Script Date: 03/20/2012 17:50:44 ******/
|
||||
GO
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
@@ -347,6 +351,11 @@ and rpt.lastauditid is not null
|
||||
return
|
||||
end
|
||||
GO
|
||||
-- Display the status of TableFunction creation
|
||||
IF (@@Error = 0) PRINT 'Function: vefn_ChronologyReport Succeeded'
|
||||
ELSE PRINT 'Function: vefn_ChronologyReport Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[PasteItemSiblingAfter] Script Date: 03/21/2012 15:25:31 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
@@ -441,6 +450,11 @@ BEGIN CATCH -- Catch Block
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: PasteItemSiblingAfter Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: PasteItemSiblingAfter Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[PasteItemSiblingBefore] Script Date: 03/21/2012 15:26:23 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
@@ -543,6 +557,11 @@ BEGIN CATCH -- Catch Block
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: PasteItemSiblingBefore Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: PasteItemSiblingBefore Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[getContentAuditsChronologyByItemID] Script Date: 03/21/2012 15:58:26 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
@@ -596,6 +615,12 @@ begin
|
||||
order by OrdinalPath, contentid,auditid--actionwhen
|
||||
RETURN
|
||||
end
|
||||
go
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'StoredProcedure [getContentAuditsChronologyByItemID] Succeeded'
|
||||
ELSE PRINT 'StoredProcedure [getContentAuditsChronologyByItemID] Error on Creation'
|
||||
go
|
||||
|
||||
GO
|
||||
/****** Object: UserDefinedFunction [dbo].[vefn_FixSearchString] Script Date: 03/26/2012 09:31:13 ******/
|
||||
SET ANSI_NULLS ON
|
||||
@@ -646,3 +671,80 @@ BEGIN
|
||||
RETURN '%' + @SearchString + '%'
|
||||
END
|
||||
GO
|
||||
-- Display the status
|
||||
IF (@@Error = 0) PRINT 'ScalerFunction [vefn_FixSearchString] Succeeded'
|
||||
ELSE PRINT 'ScalerFunction [vefn_FixSearchString] Error on Creation'
|
||||
go
|
||||
|
||||
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
/*
|
||||
restoreDeletedItem 10133,1,10130,2
|
||||
select dbo.ve_GetPartContentID(10133)
|
||||
select dbo.ve_GetPartFromType(10133)
|
||||
select itemid from parts where contentid = 10126 and fromtype = 6
|
||||
SELECT ItemID FROM PartAudits WHERE DeleteStatus = 1
|
||||
|
||||
*/
|
||||
|
||||
ALTER PROCEDURE [dbo].[restoreDeletedItem]
|
||||
(
|
||||
@ItemID int,
|
||||
@DeleteID int,
|
||||
@CurrentID int,
|
||||
@Level int
|
||||
)
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
DECLARE @PreviousID int
|
||||
DECLARE @NextID int
|
||||
DECLARE @ContentID int
|
||||
declare @fromtype int
|
||||
IF @Level = 0
|
||||
BEGIN
|
||||
SET @NextID = @CurrentID
|
||||
SELECT @PreviousID = PreviousID FROM Items WHERE ItemID = @CurrentID
|
||||
END
|
||||
IF @Level = 1
|
||||
BEGIN
|
||||
SELECT @NextID = ItemID FROM Items WHERE PreviousID = @CurrentID
|
||||
SET @PreviousID = @CurrentID
|
||||
END
|
||||
SELECT @ContentID = dbo.[ve_GetPartContentID](@ItemID)
|
||||
select @fromtype = dbo.[ve_GetPartFromType](@ItemID)
|
||||
if @level = 2
|
||||
begin
|
||||
select @NextID = itemid from parts where contentid = @contentid and fromtype = @fromtype
|
||||
end
|
||||
UPDATE tblParts SET DeleteStatus = 0 WHERE ItemID IN (SELECT ItemID FROM PartAudits WHERE DeleteStatus = @DeleteID)
|
||||
update tblparts set deletestatus = 0, itemid = @itemid where contentid = @contentid and fromtype = @fromtype
|
||||
UPDATE tblContents SET DeleteStatus = 0, ActionDTS = getdate() WHERE ContentID IN (SELECT ContentID FROM ContentAudits WHERE DeleteStatus = @DeleteID)
|
||||
UPDATE tblItems SET DeleteStatus = 0,PreviousID = CASE WHEN ItemID = @ItemID THEN @PreviousID ELSE PreviousID END
|
||||
WHERE ItemID IN (SELECT ItemID FROM ItemAudits WHERE DeleteStatus = @DeleteID)
|
||||
UPDATE tblGrids SET DeleteStatus = 0 WHERE ContentID IN (SELECT ContentID FROM ContentAudits WHERE DeleteStatus = @DeleteID)
|
||||
UPDATE tblEntries SET DeleteStatus = 0 WHERE DocID IN (SELECT DocID FROM EntryAudits WHERE DeleteStatus = @DeleteID)
|
||||
UPDATE tblAnnotations SET DeleteStatus = 0, ActionDTS = getdate() WHERE deletestatus = @deleteid -- ItemID in (SELECT ItemID FROM ItemAudits WHERE DeleteStatus = @DeleteID)
|
||||
UPDATE tblROUsages SET DeleteStatus = 0 WHERE deletestatus = @deleteid --ContentID IN (SELECT ContentID FROM ContentAudits WHERE DeleteStatus = @DeleteID)
|
||||
UPDATE tblTransitions SET DeleteStatus = 0 WHERE deletestatus = @deleteid --FromID IN (SELECT ContentID FROM ContentAudits WHERE DeleteStatus = @DeleteID)
|
||||
IF @NextID IS NOT NULL
|
||||
BEGIN
|
||||
UPDATE Items SET PreviousID = @ItemID WHERE ItemID = @NextID
|
||||
IF @ContentID IS NOT NULL
|
||||
BEGIN
|
||||
UPDATE Parts SET ItemID = @ItemID WHERE ItemID = @NextID and ContentID = @ContentID
|
||||
END
|
||||
END
|
||||
--else
|
||||
-- begin
|
||||
--update parts set itemid = @itemid where contentid = @contentid and fromtype = @fromtype
|
||||
-- end
|
||||
RETURN
|
||||
go
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: restoreDeletedItem Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: restoreDeletedItem Error on Creation'
|
||||
GO
|
||||
|
Reference in New Issue
Block a user