From b173c61575ff23d6925a112af988b00db327c613 Mon Sep 17 00:00:00 2001 From: mschill Date: Tue, 30 Jun 2026 09:11:43 -0400 Subject: [PATCH] B2026-063 - Issue Deleting Steps with Grids --- PROMS/SQL/PROMStoCM.sql | 2 +- PROMS/VEPROMS User Interface/PROMSFixes.Sql | 32 +++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/PROMS/SQL/PROMStoCM.sql b/PROMS/SQL/PROMStoCM.sql index 3191b940..9c1f62d2 100644 --- a/PROMS/SQL/PROMStoCM.sql +++ b/PROMS/SQL/PROMStoCM.sql @@ -1817,7 +1817,7 @@ ALTER trigger [dbo].[tr_Contents_Delete] on [dbo].[Contents] instead of delete a select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID where ii.DeleteStatus > 0 - update ga set ga.contentauditid = (select max(auditid) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus) + update ga set ga.contentauditid = (select ISNULL(max(auditid),0) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus) from gridaudits ga join deleted dd on ga.contentid = dd.contentid where ga.contentauditid = 0 end go diff --git a/PROMS/VEPROMS User Interface/PROMSFixes.Sql b/PROMS/VEPROMS User Interface/PROMSFixes.Sql index ec6c56c2..e48c92d3 100644 --- a/PROMS/VEPROMS User Interface/PROMSFixes.Sql +++ b/PROMS/VEPROMS User Interface/PROMSFixes.Sql @@ -24990,6 +24990,34 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getRevisionByItemIDandRevisionNumber ELSE PRINT 'Procedure Creation: getRevisionByItemIDandRevisionNumber Error on Creation' GO +/* +========================================================================================================== + Author: Matthew Schill + Create Date: 06/29/2026 + Description: Added an ISNULL check when setting GridAudits.contentauditid. + Was Causing Deletion of some Grids to fail. +========================================================================================================== +*/ +/****** Object: Trigger [tr_Contents_Delete] ******/ +ALTER trigger [dbo].[tr_Contents_Delete] on [dbo].[Contents] instead of delete as + begin + update ii set DeleteStatus = (select max(DeleteID) from DeleteLog where SPID = @@spid), ActionDTS = getdate(), + UserID = (select top 1 UserID from DeleteLog where SPID = @@spid order by deleteid desc) + from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID + insert into ContentAudits(ContentID,Number,Text,Type,FormatID,Config,DTS,UserID,DeleteStatus,ActionDTS) + select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS + from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID + where ii.DeleteStatus > 0 + update ga set ga.contentauditid = (select ISNULL(max(auditid),0) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus) + from gridaudits ga join deleted dd on ga.contentid = dd.contentid where ga.contentauditid = 0 + end +go + +-- Display the status of Trigger alter +IF (@@Error = 0) PRINT 'Trigger Alteration: tr_Contents_Delete Succeeded' +ELSE PRINT 'Trigger Alteration: tr_Contents_Delete Error on Creation' +GO + /* --------------------------------------------------------------------------- | ADD New Code Before this Block | @@ -25023,8 +25051,8 @@ BEGIN TRY -- Try Block DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '05/26/2026 7:00 AM' - set @RevDescription = 'Get Most Recent Revision when Duplicates' + set @RevDate = '06/29/2026 7:00 AM' + set @RevDescription = Update to Grid Deletion Audits' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription -- 2.52.0