Support for Change Manager
This commit is contained in:
parent
3bb7779e63
commit
bf0bae229e
@ -1018,15 +1018,31 @@ AS
|
|||||||
BEGIN TRY -- Try Block
|
BEGIN TRY -- Try Block
|
||||||
BEGIN TRANSACTION
|
BEGIN TRANSACTION
|
||||||
DECLARE @ChildID int, @ContentID int, @ParentContentID int, @LastChanged timestamp
|
DECLARE @ChildID int, @ContentID int, @ParentContentID int, @LastChanged timestamp
|
||||||
, @newLastChanged timestamp, @Error int, @Rowcount int
|
, @newLastChanged timestamp, @Error int, @Rowcount int, @ChildDeleted int
|
||||||
SELECT @ChildID = pp.[ItemID],@ParentContentID = ii.ContentID, @LastChanged = pp.LastChanged
|
SELECT @ChildID = pp.[ItemID],@ParentContentID = ii.ContentID, @LastChanged = pp.LastChanged
|
||||||
FROM [ITEMS] ii
|
FROM [ITEMS] ii
|
||||||
LEFT JOIN [PARTS] pp on pp.ContentID=ii.ContentID and pp.FromType=@FromType
|
LEFT JOIN [PARTS] pp on pp.ContentID=ii.ContentID and pp.FromType=@FromType
|
||||||
WHERE ii.[ItemID]=@ItemID
|
WHERE ii.[ItemID]=@ItemID
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[tblParts]') AND OBJECTPROPERTY(id,N'IsTable') = 1)
|
||||||
|
BEGIN
|
||||||
|
SELECT @ChildDeleted = pp.[ItemID],@ParentContentID = ii.ContentID, @LastChanged = pp.LastChanged
|
||||||
|
FROM [ITEMS] ii
|
||||||
|
LEFT JOIN [tblPARTS] pp on pp.ContentID=ii.ContentID and pp.FromType=@FromType
|
||||||
|
WHERE ii.[ItemID]=@ItemID and pp.DateEnd is not null
|
||||||
|
END
|
||||||
EXECUTE AddContent @Number, @Text, @Type, @FormatID, @Config, @DTS, @UserID, @ContentID output, @newLastChanged output
|
EXECUTE AddContent @Number, @Text, @Type, @FormatID, @Config, @DTS, @UserID, @ContentID output, @newLastChanged output
|
||||||
EXECUTE AddItem null, @ContentID, @DTS, @UserID , @newItemID output, @newLastChanged output
|
EXECUTE AddItem null, @ContentID, @DTS, @UserID , @newItemID output, @newLastChanged output
|
||||||
IF @ChildID is null -- No existing child - Add Parts record
|
IF @ChildID is null -- No existing child - Add Parts record
|
||||||
|
BEGIN
|
||||||
|
IF @ChildDeleted is not null
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO [tblParts_shadow] ([ContentID],[FromType],[ItemID],[DTS],[UserID],[DateEnd])
|
||||||
|
SELECT [ContentID],[FromType],[ItemID],[DTS],[UserID],[DateEnd] FROM [tblParts]
|
||||||
|
WHERE ItemID = @ChildDeleted
|
||||||
|
DELETE FROM [tblParts] WHERE ItemID = @ChildDeleted
|
||||||
|
END
|
||||||
EXECUTE AddPart @ParentContentID, @FromType, @newItemID, @DTS, @UserID, @newLastChanged output
|
EXECUTE AddPart @ParentContentID, @FromType, @newItemID, @DTS, @UserID, @newLastChanged output
|
||||||
|
END
|
||||||
ELSE -- Update existing Parts record
|
ELSE -- Update existing Parts record
|
||||||
BEGIN
|
BEGIN
|
||||||
EXECUTE UpdatePart @ParentContentID, @FromType, @newItemID, @DTS, @UserID, @LastChanged, @newLastChanged output
|
EXECUTE UpdatePart @ParentContentID, @FromType, @newItemID, @DTS, @UserID, @LastChanged, @newLastChanged output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user