Add exception if any external transitions to a procedure.
This commit is contained in:
parent
b57e0b59d6
commit
3ef663d7e3
@ -8882,6 +8882,7 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @PreviousItemID AS INT
|
DECLARE @PreviousItemID AS INT
|
||||||
DECLARE @ExternalChildCount AS INT
|
DECLARE @ExternalChildCount AS INT
|
||||||
DECLARE @ExternalCount AS INT
|
DECLARE @ExternalCount AS INT
|
||||||
|
DECLARE @ItemType AS INT
|
||||||
DECLARE @Path AS VARCHAR(MAX)
|
DECLARE @Path AS VARCHAR(MAX)
|
||||||
DECLARE @Children AS TABLE
|
DECLARE @Children AS TABLE
|
||||||
(
|
(
|
||||||
@ -8899,17 +8900,25 @@ BEGIN TRY -- Try Block
|
|||||||
)
|
)
|
||||||
SET NOCOUNT ON
|
SET NOCOUNT ON
|
||||||
SELECT @ContentID = ContentID, @PreviousItemID = PreviousID FROM Items WHERE ItemID = @ItemID
|
SELECT @ContentID = ContentID, @PreviousItemID = PreviousID FROM Items WHERE ItemID = @ItemID
|
||||||
SELECT @NextItemID = ItemID FROM Items ii join Contents cc on cc.contentid = ii.contentid WHERE PreviousID = @ItemID and cc.type > 0
|
SELECT @NextItemID = ItemID FROM Items WHERE PreviousID = @ItemID
|
||||||
|
|
||||||
SELECT @ExternalCount = count(*) FROM vefn_FindExternalTransitions(@ItemID) where rangeid = toid or toid = @ItemID
|
SELECT @ExternalCount = count(*) FROM vefn_FindExternalTransitions(@ItemID) where rangeid = toid or toid = @ItemID
|
||||||
SELECT @ExternalChildCount = count(*) FROM vefn_FindExternalChildTransitions(@ItemID)
|
SELECT @ExternalChildCount = count(*) FROM vefn_FindExternalChildTransitions(@ItemID)
|
||||||
|
SELECT @ItemType = Type FROM Contents Where ContentID = @ContentID
|
||||||
SET @Path = [dbo].[ve_GetShortPath](@ItemID)
|
SET @Path = [dbo].[ve_GetShortPath](@ItemID)
|
||||||
|
-- Check to see if External Transitions point to the current item
|
||||||
IF @ExternalCount > 0 AND @NextItemID is null
|
IF @ExternalCount > 0 AND @NextItemID is null
|
||||||
BEGIN
|
BEGIN
|
||||||
RAISERROR ('###Cannot Delete Item###Step %d has External Transitions and has no next step - (%s)',16,1,@ItemID,@Path)
|
RAISERROR ('###Cannot Delete Item###Step %d has External Transitions and has no next step - (%s)',16,1,@ItemID,@Path)
|
||||||
RETURN
|
RETURN
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IF @ExternalCount > 0 AND @ItemType < 10000
|
||||||
|
BEGIN
|
||||||
|
RAISERROR ('###Cannot Delete Item###Procedure %d has External Transitions to Procedure - (%s)',16,1,@ItemID,@Path)
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
IF @ExternalChildCount > 0
|
IF @ExternalChildCount > 0
|
||||||
BEGIN
|
BEGIN
|
||||||
RAISERROR ('###Cannot Delete Item###Step %d has External Transitions to it''s children - (%s)',16,1,@ItemID,@Path)
|
RAISERROR ('###Cannot Delete Item###Step %d has External Transitions to it''s children - (%s)',16,1,@ItemID,@Path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user