C2015-036: Modified “vesp_GetTransitionReportData” to return correct data for outside transitions

This commit is contained in:
Kathy Ruffing 2015-08-25 14:52:59 +00:00
parent f4e1c63ec1
commit af82e4c2cb

View File

@ -9584,7 +9584,7 @@ GO
SET QUOTED_IDENTIFIER ON
GO
/*
vesp_GetTransitionReportData 1,1
vesp_GetTransitionReportData 5, 6078
*/
CREATE PROCEDURE vesp_GetTransitionReportData
(
@ -9612,9 +9612,11 @@ BEGIN
(
tid int primary key
)
insert into @itmp select * from vefn_getversionprocedureitems(@VersionID)
insert into @itmp select * from vefn_getversionprocedureitems('')
insert into @ctmp select * from @itmp
insert into @ttmp select tt.TransitionID from Transitions tt join @ctmp ct on tt.FromID = ct.cid join @itmp it on tt.ToID = it.iid
insert into @ttmp
select tt.TransitionID from Transitions tt join @ctmp ct on tt.FromID = ct.cid join @itmp it on tt.ToID = it.iid
where ct.pid = @ProcedureID or it.pid = @ProcedureID
--internal
select 1 level,tt.*,
(SELECT COUNT(*) FROM [ZTransitions] WHERE [ZTransitions].[TransitionID]=tt.[TransitionID]) [ZTransitionCount]
@ -9631,7 +9633,7 @@ BEGIN
join @ttmp tp on tt.TransitionID = tp.tid
join @ctmp ct on tt.FromID = ct.cid
join @itmp it on tt.ToID = it.iid
where ct.pid = @ProcedureID and it.pid != @ProcedureID
where ct.vid = it.vid and ct.pid = @ProcedureID and it.pid != @ProcedureID
--external to
union
select 3 level,tt.*,
@ -9640,7 +9642,7 @@ BEGIN
join @ttmp tp on tt.TransitionID = tp.tid
join @ctmp ct on tt.FromID = ct.cid
join @itmp it on tt.ToID = it.iid
where ct.pid != @ProcedureID and it.pid = @ProcedureID
where ct.vid = it.vid and ct.pid != @ProcedureID and it.pid = @ProcedureID
--outside from
union
select 4 level,tt.*,
@ -9648,8 +9650,8 @@ BEGIN
from Transitions tt
join @ttmp tp on tt.TransitionID = tp.tid
join @ctmp ct on tt.FromID = ct.cid
join Items ii on tt.ToID = ii.ItemID
where ct.pid = @ProcedureID and ii.ItemID not in (select iid from @itmp)
join @itmp it on tt.ToID = it.iid
where ct.vid != it.vid and ct.pid = @ProcedureID-- and ii.ItemID not in (select iid from @itmp)
--outside to
union
select 5 level,tt.*,
@ -9657,12 +9659,11 @@ BEGIN
from Transitions tt
join @ttmp tp on tt.TransitionID = tp.tid
join @itmp it on tt.ToID = it.iid
join Items ii on tt.FromID = ii.ContentID
where it.pid = @ProcedureID and ii.ContentID not in (select cid from @ctmp)
join @ctmp ct on tt.FromID = ct.cid
where ct.vid != it.vid and it.pid = @ProcedureID --and ii.ContentID not in (select cid from @ctmp)
RETURN
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetTransitionReportData Succeeded'
ELSE PRINT 'Procedure Creation: vesp_GetTransitionReportData Error on Creation'