multi-user enhancements for Folders/Sessions

This commit is contained in:
Kathy Ruffing 2015-05-14 14:31:48 +00:00
parent 7af7f043fd
commit da37a78190

View File

@ -7425,7 +7425,7 @@ WITH EXECUTE AS OWNER
AS
BEGIN TRY -- Try Block
DECLARE @oCount int
SELECT @oCount = count(*) FROM Owners WHERE OwnerType = 3
SELECT @oCount = count(*) FROM Owners WHERE OwnerType = 4
IF @oCount > 0 BEGIN
SELECT
[SessionID],
@ -7816,7 +7816,7 @@ BEGIN
--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 = 3 BEGIN
IF @ObjectType = 4 BEGIN
SELECT
[SessionID],
[UserID],
@ -7868,6 +7868,28 @@ BEGIN
INNER JOIN Owners oo ON ee.DocID = oo.OwnerItemID
INNER JOIN Sessions ss ON oo.SessionID = ss.SessionID
END
--look to see if object type is folder that no part of folder passed is checked out
IF @ObjectType = 3 BEGIN
DECLARE @VersionID int
SELECT @VersionID = VersionID from DocVersions
WHERE FolderID = @ObjectID
-- Add this DocVersion to @Checkouts
INSERT INTO @CheckOuts SELECT DISTINCT SessionID FROM Owners WHERE OwnerItemID = @VersionID AND OwnerType = 2
--see what procedures maybe checked out
INSERT INTO @CheckOuts
SELECT ss.SessionID FROM dbo.vefn_GetVersiONItems(@VersionID) vi
INNER JOIN Contents cc ON vi.ContentID = cc.ContentID
INNER JOIN Owners oo ON vi.ItemID = oo.OwnerItemID
INNER JOIN Sessions ss ON oo.SessionID = ss.SessionID
WHERE cc.Type = 0
--see what documents maybe checked out
INSERT INTO @CheckOuts
SELECT ss.SessionID FROM dbo.vefn_GetVersiONItems(@VersionID) vi
INNER JOIN Contents cc ON vi.ContentID = cc.ContentID
INNER JOIN Entries ee ON vi.ContentID = ee.ContentID
INNER JOIN Owners oo ON ee.DocID = oo.OwnerItemID
INNER JOIN Sessions ss ON oo.SessionID = ss.SessionID
END
SELECT
[SessionID],
@ -10737,3 +10759,55 @@ GO
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ListContentsAfterLastChanged2 Succeeded'
ELSE PRINT 'Procedure Creation: vesp_ListContentsAfterLastChanged2 Error on Creation'
GO
/****** Object: StoredProcedure[getOwnerBySessionIDandFolderID] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getOwnerBySessionIDandFolderID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE getOwnerBySessionIDandFolderID;
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2015 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[getOwnerBySessionIDandFolderID]
(
@SessionID int,
@FolderID int
)
WITH EXECUTE AS OWNER
AS
BEGIN
DECLARE @VersionID int
SELECT @VersionID = VersionID from DocVersions WHERE FolderID = @FolderID
SELECT
[OwnerID],
[SessionID],
[OwnerType],
[OwnerItemID],
[DTSStart],
[LastChanged]
FROM [Owners] oo
INNER JOIN
(
-- 0 is procedures
SELECT 0 ObjectType,ItemID ObjectID FROM dbo.vefn_GetVersionItems(@VersionID)
UNION
-- 1 is documents
SELECT 1 ObjectType,ee.DocID ObjectID FROM dbo.vefn_GetVersionItems(@VersionID) vi
INNER JOIN Contents cc ON vi.ContentID = cc.ContentID
INNER JOIN Entries ee ON vi.ContentID = ee.ContentID
UNION
-- 2 is DocVersions
SELECT 2 ObjectType, @VersionID ObjectID
UNION
-- 3 is Folders
SELECT 3 ObjectType, @FolderID ObjectID
) tt ON oo.OwnerType = tt.ObjectType and oo.OwnerItemID = tt.ObjectID
WHERE [SessionID] = @SessionID
RETURN
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: getOwnerBySessionIDandFolderID Succeeded'
ELSE PRINT 'Procedure Creation: getOwnerBySessionIDandFolderID Error on Creation'
GO