C2026-009 Reset Change Bars to Date of Last Approval
This commit is contained in:
@@ -24533,6 +24533,51 @@ GO
|
||||
PRINT 'Added IX_tblROUsagesRODbIDDeleteStatusROID Index. Speeds up RO queries'
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetCurrentApprovedRevisions]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [GetCurrentApprovedRevisions];
|
||||
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[GetCurrentApprovedRevisions] Script Date: 02/05/2026 7:54:42 AM ******/
|
||||
|
||||
-- =============================================
|
||||
-- Author: Matthew Schill
|
||||
-- Create date: 02/05/2026
|
||||
-- Description: Gets all current approved revisions
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[GetCurrentApprovedRevisions]
|
||||
(
|
||||
@ItemID AS bigint
|
||||
)
|
||||
AS
|
||||
BEGIN
|
||||
|
||||
select max(rr.revisionid) revisionid, UnitId, UnitVal.name UnitName, max(rr.DTS) DTS
|
||||
from items ii
|
||||
inner join revisions rr on ii.itemid = rr.itemid
|
||||
inner join versions vv on rr.revisionid = vv.revisionid
|
||||
inner join stages ss on vv.stageid = ss.stageid
|
||||
outer apply
|
||||
(Select UnitId = r1.value('@Index','int') FROM rr.config.nodes('Config/Applicability') t1(r1)) App
|
||||
left outer join
|
||||
(select r1.value('@index','int') indx
|
||||
,r1.value('@Name','varchar') name
|
||||
from (select *,cast(config as xml) xconfig from DocVersions
|
||||
where ItemID in(select itemID from vefn_AllSiblingItems(@ItemID))) SDV
|
||||
cross apply
|
||||
xconfig.nodes('Config/Slaves/Slave') t1(r1)) UnitVal ON UnitVal.indx = UnitId
|
||||
where ss.isapproved = 1
|
||||
and ii.itemid = @ItemID
|
||||
group by UnitId, UnitVal.name
|
||||
|
||||
RETURN
|
||||
END
|
||||
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Error on Creation'
|
||||
GO
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
| ADD New Code Before this Block |
|
||||
@@ -24566,8 +24611,8 @@ BEGIN TRY -- Try Block
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
|
||||
set @RevDate = '02/06/2026 1:00 PM'
|
||||
set @RevDescription = 'Updated Search Tool to better handle Cautions and Notes at the same level'
|
||||
set @RevDate = '02/09/2026 7:00 AM'
|
||||
set @RevDescription = 'Added procedure for getting current revisions'
|
||||
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
|
||||
Reference in New Issue
Block a user