B2020-094: Saving of Folder properties crashed
This commit is contained in:
parent
cfc1259b48
commit
780e8d1503
@ -16021,6 +16021,163 @@ IF (@@Error = 0) PRINT 'Procedure Creation: [DeleteItemAndChildren] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [DeleteItemAndChildren] Error on Creation'
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_SessionCanCheckOutItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_SessionCanCheckOutItem];
|
||||
GO
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
/*
|
||||
exec dbo.vesp_SessionCanCheckOutItem 1,2
|
||||
exec dbo.vesp_SessionCanCheckOutItem 21,3
|
||||
*/
|
||||
CREATE PROCEDURE [dbo].[vesp_SessionCanCheckOutItem]
|
||||
(
|
||||
@ObjectID int,
|
||||
@ObjectType int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @CheckOuts TABLE
|
||||
(
|
||||
SessionID int
|
||||
)
|
||||
--look to see if anyone else has a session. if they do, then cannot check out
|
||||
DECLARE @sCount int
|
||||
SELECT @sCount = count(*) FROM Sessions
|
||||
IF @ObjectType = 4 BEGIN
|
||||
SELECT
|
||||
[SessionID],
|
||||
[UserID],
|
||||
[DTSDtart],
|
||||
[DTSEnd],
|
||||
[DTSActivity],
|
||||
[LastChanged],
|
||||
[MachineName],
|
||||
[ProcessID],
|
||||
(select convert(bigint,max(lastchanged)) from contents) LastContentChange
|
||||
FROM [Sessions]
|
||||
WHERE DTSEnd IS NULL
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
DECLARE @ObjectAndEnhancedIDs Table
|
||||
(
|
||||
ObjectID int
|
||||
)
|
||||
IF @ObjectType = 0 BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs
|
||||
select ItemID from vefn_GetEnhancedProcedures(@ObjectID)
|
||||
END
|
||||
ELSE IF @ObjectType = 2 BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs
|
||||
select VersionID from vefn_GetEnhancedDocVersions(@ObjectID)
|
||||
INSERT INTO @ObjectAndEnhancedIDs -- B2020-094: Check current docversion
|
||||
select VersionID from DocVersions where VersionId = @ObjectID
|
||||
END
|
||||
ELSE IF @ObjectType = 3 BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs
|
||||
select FolderID from vefn_GetEnhancedFolders(@ObjectID)
|
||||
INSERT INTO @ObjectAndEnhancedIDs -- B2020-094: Check current folder
|
||||
select FolderID from Folders where FolderID = @ObjectID
|
||||
END
|
||||
ELSE BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs select @ObjectID
|
||||
END
|
||||
INSERT INTO @CheckOuts SELECT DISTINCT SessionID FROM Owners
|
||||
WHERE OwnerItemID in (select ObjectID from @ObjectAndEnhancedIDs) AND OwnerType = @ObjectType
|
||||
IF @ObjectType = 2
|
||||
BEGIN
|
||||
with ItemZ (VersionID,ItemID,PreviousID,SessionID)
|
||||
as(
|
||||
--> Procedure Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Items II on OO.OwnerItemID= II.ItemID
|
||||
Where OO.OwnerType=0
|
||||
UNION ALL --> Document Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Entries EE ON OO.OwnerItemID = EE.DocID
|
||||
Join Items II on EE.ContentID= II.ContentID
|
||||
Where OO.OwnerType=1
|
||||
UNION ALL --> Previous Owners
|
||||
Select null, ii.ItemID, ii.PreviousID,ZZ.SessionID From ItemZ ZZ
|
||||
Join Items II ON II.ItemID = ZZ.PreviousID
|
||||
Where ZZ.VersionID IS NULL and ZZ.PreviousID IS NOT NULL
|
||||
UNION ALL -- Parts Owners
|
||||
Select null, II.ItemID, II.PreviousID, ZZ.SessionID
|
||||
from ItemZ ZZ
|
||||
Join Parts PP ON PP.ItemID = ZZ.ItemID
|
||||
Join Items II ON II.ContentID = PP.ContentID
|
||||
Where ZZ.VersionID IS NULL
|
||||
UNION ALL -- Version Owners
|
||||
Select DV.VersionID,null,null,ZZ.SessionID From ItemZ ZZ
|
||||
Join DocVersions DV ON ZZ.ItemID = DV.ItemID
|
||||
Where ZZ.VersionID IS NULL AND ZZ.PreviousID IS NULL
|
||||
)
|
||||
--Select Distinct 'Phase 2b' Result, * from Itemz
|
||||
INSERT INTO @CheckOuts
|
||||
Select DIstinct SessionID from ItemZ
|
||||
where VersionID in(select ObjectID FROM @ObjectAndEnhancedIDs)
|
||||
OPTION (MAXRECURSION 10000) -- B2017-144 Crash on Maximum Recursion
|
||||
END
|
||||
--look to see if object type is folder that no part of folder passed is checked out
|
||||
IF @ObjectType = 3 BEGIN
|
||||
with ItemZ (VersionID,ItemID,PreviousID,SessionID)
|
||||
as(
|
||||
--> Procedure Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Items II on OO.OwnerItemID= II.ItemID
|
||||
Where OO.OwnerType=0
|
||||
UNION ALL --> Document Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Entries EE ON OO.OwnerItemID = EE.DocID
|
||||
Join Items II on EE.ContentID= II.ContentID
|
||||
Where OO.OwnerType=1
|
||||
UNION ALL --> Previous Owners
|
||||
Select null, ii.ItemID, ii.PreviousID,ZZ.SessionID From ItemZ ZZ
|
||||
Join Items II ON II.ItemID = ZZ.PreviousID
|
||||
Where ZZ.VersionID IS NULL and ZZ.PreviousID IS NOT NULL
|
||||
UNION ALL -- Parts Owners
|
||||
Select null, II.ItemID, II.PreviousID, ZZ.SessionID
|
||||
from ItemZ ZZ
|
||||
Join Parts PP ON PP.ItemID = ZZ.ItemID
|
||||
Join Items II ON II.ContentID = PP.ContentID
|
||||
Where ZZ.VersionID IS NULL
|
||||
UNION ALL -- Version Owners
|
||||
Select DV.VersionID,null,null,ZZ.SessionID From ItemZ ZZ
|
||||
Join DocVersions DV ON ZZ.ItemID = DV.ItemID
|
||||
Where ZZ.VersionID IS NULL AND ZZ.PreviousID IS NULL
|
||||
)
|
||||
--Select Distinct 'Phase 2b' Result, * from Itemz
|
||||
INSERT INTO @CheckOuts
|
||||
Select DIstinct SessionID from ItemZ
|
||||
where VersionID in(select ObjectID FROM @ObjectAndEnhancedIDs)
|
||||
OPTION (MAXRECURSION 10000) -- B2017-144 Crash on Maximum Recursion
|
||||
END
|
||||
SELECT
|
||||
[SessionID],
|
||||
[UserID],
|
||||
[DTSDtart],
|
||||
[DTSEnd],
|
||||
[DTSActivity],
|
||||
[LastChanged],
|
||||
[MachineName],
|
||||
[ProcessID],
|
||||
(select convert(bigint,max(lastchanged)) from contents) LastContentChange
|
||||
FROM [Sessions]
|
||||
WHERE [SessionID] IN (SELECT SessionID FROM @CheckOuts)
|
||||
END
|
||||
END
|
||||
GO
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_SessionCanCheckOutItem] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [vesp_SessionCanCheckOutItem] Error on Creation'
|
||||
GO
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
/*
|
||||
@ -16047,8 +16204,8 @@ BEGIN TRY -- Try Block
|
||||
set nocount on
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
set @RevDate = '07/15/2020 10:00 AM'
|
||||
set @RevDescription = 'Do not delete section if transitions point to it'
|
||||
set @RevDate = '07/30/2020 10:00 AM'
|
||||
set @RevDescription = 'Only allow one user to access properties for Folders and DocVersions'
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
|
@ -16021,6 +16021,163 @@ IF (@@Error = 0) PRINT 'Procedure Creation: [DeleteItemAndChildren] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [DeleteItemAndChildren] Error on Creation'
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_SessionCanCheckOutItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_SessionCanCheckOutItem];
|
||||
GO
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
/*
|
||||
exec dbo.vesp_SessionCanCheckOutItem 1,2
|
||||
exec dbo.vesp_SessionCanCheckOutItem 21,3
|
||||
*/
|
||||
CREATE PROCEDURE [dbo].[vesp_SessionCanCheckOutItem]
|
||||
(
|
||||
@ObjectID int,
|
||||
@ObjectType int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @CheckOuts TABLE
|
||||
(
|
||||
SessionID int
|
||||
)
|
||||
--look to see if anyone else has a session. if they do, then cannot check out
|
||||
DECLARE @sCount int
|
||||
SELECT @sCount = count(*) FROM Sessions
|
||||
IF @ObjectType = 4 BEGIN
|
||||
SELECT
|
||||
[SessionID],
|
||||
[UserID],
|
||||
[DTSDtart],
|
||||
[DTSEnd],
|
||||
[DTSActivity],
|
||||
[LastChanged],
|
||||
[MachineName],
|
||||
[ProcessID],
|
||||
(select convert(bigint,max(lastchanged)) from contents) LastContentChange
|
||||
FROM [Sessions]
|
||||
WHERE DTSEnd IS NULL
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
DECLARE @ObjectAndEnhancedIDs Table
|
||||
(
|
||||
ObjectID int
|
||||
)
|
||||
IF @ObjectType = 0 BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs
|
||||
select ItemID from vefn_GetEnhancedProcedures(@ObjectID)
|
||||
END
|
||||
ELSE IF @ObjectType = 2 BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs
|
||||
select VersionID from vefn_GetEnhancedDocVersions(@ObjectID)
|
||||
INSERT INTO @ObjectAndEnhancedIDs -- B2020-094: Check current docversion
|
||||
select VersionID from DocVersions where VersionId = @ObjectID
|
||||
END
|
||||
ELSE IF @ObjectType = 3 BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs
|
||||
select FolderID from vefn_GetEnhancedFolders(@ObjectID)
|
||||
INSERT INTO @ObjectAndEnhancedIDs -- B2020-094: Check current folder
|
||||
select FolderID from Folders where FolderID = @ObjectID
|
||||
END
|
||||
ELSE BEGIN
|
||||
INSERT INTO @ObjectAndEnhancedIDs select @ObjectID
|
||||
END
|
||||
INSERT INTO @CheckOuts SELECT DISTINCT SessionID FROM Owners
|
||||
WHERE OwnerItemID in (select ObjectID from @ObjectAndEnhancedIDs) AND OwnerType = @ObjectType
|
||||
IF @ObjectType = 2
|
||||
BEGIN
|
||||
with ItemZ (VersionID,ItemID,PreviousID,SessionID)
|
||||
as(
|
||||
--> Procedure Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Items II on OO.OwnerItemID= II.ItemID
|
||||
Where OO.OwnerType=0
|
||||
UNION ALL --> Document Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Entries EE ON OO.OwnerItemID = EE.DocID
|
||||
Join Items II on EE.ContentID= II.ContentID
|
||||
Where OO.OwnerType=1
|
||||
UNION ALL --> Previous Owners
|
||||
Select null, ii.ItemID, ii.PreviousID,ZZ.SessionID From ItemZ ZZ
|
||||
Join Items II ON II.ItemID = ZZ.PreviousID
|
||||
Where ZZ.VersionID IS NULL and ZZ.PreviousID IS NOT NULL
|
||||
UNION ALL -- Parts Owners
|
||||
Select null, II.ItemID, II.PreviousID, ZZ.SessionID
|
||||
from ItemZ ZZ
|
||||
Join Parts PP ON PP.ItemID = ZZ.ItemID
|
||||
Join Items II ON II.ContentID = PP.ContentID
|
||||
Where ZZ.VersionID IS NULL
|
||||
UNION ALL -- Version Owners
|
||||
Select DV.VersionID,null,null,ZZ.SessionID From ItemZ ZZ
|
||||
Join DocVersions DV ON ZZ.ItemID = DV.ItemID
|
||||
Where ZZ.VersionID IS NULL AND ZZ.PreviousID IS NULL
|
||||
)
|
||||
--Select Distinct 'Phase 2b' Result, * from Itemz
|
||||
INSERT INTO @CheckOuts
|
||||
Select DIstinct SessionID from ItemZ
|
||||
where VersionID in(select ObjectID FROM @ObjectAndEnhancedIDs)
|
||||
OPTION (MAXRECURSION 10000) -- B2017-144 Crash on Maximum Recursion
|
||||
END
|
||||
--look to see if object type is folder that no part of folder passed is checked out
|
||||
IF @ObjectType = 3 BEGIN
|
||||
with ItemZ (VersionID,ItemID,PreviousID,SessionID)
|
||||
as(
|
||||
--> Procedure Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Items II on OO.OwnerItemID= II.ItemID
|
||||
Where OO.OwnerType=0
|
||||
UNION ALL --> Document Owners
|
||||
select null,II.ItemID, PreviousID, SessionID
|
||||
from Owners OO
|
||||
Join Entries EE ON OO.OwnerItemID = EE.DocID
|
||||
Join Items II on EE.ContentID= II.ContentID
|
||||
Where OO.OwnerType=1
|
||||
UNION ALL --> Previous Owners
|
||||
Select null, ii.ItemID, ii.PreviousID,ZZ.SessionID From ItemZ ZZ
|
||||
Join Items II ON II.ItemID = ZZ.PreviousID
|
||||
Where ZZ.VersionID IS NULL and ZZ.PreviousID IS NOT NULL
|
||||
UNION ALL -- Parts Owners
|
||||
Select null, II.ItemID, II.PreviousID, ZZ.SessionID
|
||||
from ItemZ ZZ
|
||||
Join Parts PP ON PP.ItemID = ZZ.ItemID
|
||||
Join Items II ON II.ContentID = PP.ContentID
|
||||
Where ZZ.VersionID IS NULL
|
||||
UNION ALL -- Version Owners
|
||||
Select DV.VersionID,null,null,ZZ.SessionID From ItemZ ZZ
|
||||
Join DocVersions DV ON ZZ.ItemID = DV.ItemID
|
||||
Where ZZ.VersionID IS NULL AND ZZ.PreviousID IS NULL
|
||||
)
|
||||
--Select Distinct 'Phase 2b' Result, * from Itemz
|
||||
INSERT INTO @CheckOuts
|
||||
Select DIstinct SessionID from ItemZ
|
||||
where VersionID in(select ObjectID FROM @ObjectAndEnhancedIDs)
|
||||
OPTION (MAXRECURSION 10000) -- B2017-144 Crash on Maximum Recursion
|
||||
END
|
||||
SELECT
|
||||
[SessionID],
|
||||
[UserID],
|
||||
[DTSDtart],
|
||||
[DTSEnd],
|
||||
[DTSActivity],
|
||||
[LastChanged],
|
||||
[MachineName],
|
||||
[ProcessID],
|
||||
(select convert(bigint,max(lastchanged)) from contents) LastContentChange
|
||||
FROM [Sessions]
|
||||
WHERE [SessionID] IN (SELECT SessionID FROM @CheckOuts)
|
||||
END
|
||||
END
|
||||
GO
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_SessionCanCheckOutItem] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [vesp_SessionCanCheckOutItem] Error on Creation'
|
||||
GO
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
/*
|
||||
@ -16047,8 +16204,8 @@ BEGIN TRY -- Try Block
|
||||
set nocount on
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
set @RevDate = '07/15/2020 10:00 AM'
|
||||
set @RevDescription = 'Do not delete section if transitions point to it'
|
||||
set @RevDate = '07/30/2020 10:00 AM'
|
||||
set @RevDescription = 'Only allow one user to access properties for Folders and DocVersions'
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user