Modified stored procedure CopyItemAndChildren to fix updating the SectionStart value stored in the procedure config which indicates the default section of a copied procedure.
This commit is contained in:
parent
018599a9e7
commit
18e8d73d70
@ -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%')
|
||||
begin
|
||||
--foldouts fixing code
|
||||
if exists (select * from contents where contentid in (select newcontentid from @children) and config like '%FloatingFoldout%')
|
||||
begin
|
||||
--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
|
||||
|
Loading…
x
Reference in New Issue
Block a user