From 18e8d73d7062ba64eb4f43479241b5ea602edd1e Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 12 Sep 2014 01:07:34 +0000 Subject: [PATCH] Modified stored procedure CopyItemAndChildren to fix updating the SectionStart value stored in the procedure config which indicates the default section of a copied procedure. --- PROMS/DataLoader/PROMSFixes.Sql | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index c84a44f4..11c05bae 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -9082,9 +9082,9 @@ UPDATE TR SET TR.[TranType] = .dbo.vefn_GetNewTranType(NN.FormatID, NN.NewFormat -- Transitions are done -- SELECT * From Transitions where DTS = @DTS and UserID = @UserID --print 'Z ' + cast(datediff(s,@dts,getdate()) as varchar(100)) -if exists (select * from contents where config like '%FloatingFoldout%') +--foldouts fixing code +if exists (select * from contents where contentid in (select newcontentid from @children) and config like '%FloatingFoldout%') begin - --foldouts fixing code --insert into #mytemp select cc.contentid,xsteps.value('@FloatingFoldout','int') oldfoldoutid,(select newitemid from @children @@ -9114,8 +9114,29 @@ begin update cc set config = cast(xconfig as varchar(max)) from contents cc join #mytemp mt on cc.contentid = mt.contentid --get rid of #mytemp drop table #mytemp - --end foldouts fixing code end +--end foldouts fixing code +--section start +DECLARE @NewContentID int +Select @NewContentID = NewContentID from @Children where ItemID = @StartItemID +DECLARE @Config varchar(max) +DECLARE @XConfig xml +select @Config = config from contents where contentid = @NewContentID +select @XConfig = cast(@Config as xml) +if @Config like '%SectionStart%' begin + DECLARE @SectionStart int + select @SectionStart = xproc.value('@SectionStart','int') from @xconfig.nodes('Config/Procedure') tproc(xproc) + DECLARE @NewSectionStart int + select @NewSectionStart = newitemid from @children where itemid = @SectionStart + DECLARE @cmd2 nvarchar(max) + set @cmd2 = ' + declare @XConfig xml; + set @XConfig = cast(''' + @Config + ''' as xml); + set @XConfig.modify(''replace value of (Config/Procedure/@SectionStart)[1] with "' + cast(@NewSectionStart as nvarchar(10)) + '"''); + update contents set config = cast(@XConfig as varchar(max)) where contentid = ' + cast(@NewContentID as nvarchar(10)) + ';' + exec sp_executesql @cmd2 +end +--end section start IF( @@TRANCOUNT > 0 ) COMMIT END TRY BEGIN CATCH -- Catch Block