From f41a41c2ed6d5881d42686972d37de17cdbf3103 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 4 Jun 2019 14:43:18 +0000 Subject: [PATCH] B2019-992: Changing transition type has missing section text --- .../frmSectionProperties.cs | 52 ++++++++++++++++--- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index 8f5048be..dd146cbc 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -174,15 +174,44 @@ namespace VEPROMS _DocumentToDelete = null; } mySection.Dispose(); - - // if this section is now the 'DefaultStepSection', clear all others (only 1 section can have - // this property set - it is used when printing page numbers with 'WithSteps' numbering sequence. - if (!_isDefaultStepSection && ppCbDefaultStepSection.Checked) + // B2019-002: if there is more than one default step section (probably from migrated data), and this section was updated to not + // be the default section, then reset the procedure's default section id. + if (_isDefaultStepSection && !ppCbDefaultStepSection.Checked) { - foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections) + // find first section in list that has originalsteps (flags a default section) + int defsctId = 0; + foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections) { SectionConfig sc = si.MyConfig as SectionConfig; - if (si.ItemID != _SectionConfig.MySection.ItemID && sc!=null && sc.Section_OriginalSteps == "Y") + if (si.ItemID != _SectionConfig.MySection.ItemID && sc != null && sc.Section_OriginalSteps == "Y") + { + defsctId = si.ItemID; + break; + } + } + if (defsctId != 0) + { + // also need to set the procedure's config sectionstart to the selected section + // if it is not set: + using (Procedure p = Procedure.Get(_SectionConfig.MySection.MySectionInfo.MyProcedure.ItemID)) + { + if (p.ProcedureConfig.SectionStart != defsctId.ToString()) + { + p.ProcedureConfig.SectionStart = defsctId.ToString(); + p.Save(); + ItemInfo.Refresh(p); + } + } + } + } + // if this section is now the 'DefaultStepSection', clear all others (only 1 section can have + // this property set - it is used when printing page numbers with 'WithSteps' numbering sequence. + else if (!_isDefaultStepSection && ppCbDefaultStepSection.Checked) + { + foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections) + { + SectionConfig sc = si.MyConfig as SectionConfig; + if (si.ItemID != _SectionConfig.MySection.ItemID && sc != null && sc.Section_OriginalSteps == "Y") { using (Section ssav = si.Get()) { @@ -1242,7 +1271,16 @@ namespace VEPROMS { if (!_Initializing) { - if (!ppCbDefaultStepSection.Checked) + // B2019-002: if there is more than one default step section (probably from migrated data), then allow this to be turned off. + // The bug was on changing a transition type that included a section header - but the section header was not included + // in the transition text if it was a default: + int cntDefaultSect = 0; + foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections) + { + SectionConfig sc = si.MyConfig as SectionConfig; + if (sc != null && sc.Section_OriginalSteps == "Y") cntDefaultSect++; + } + if (!ppCbDefaultStepSection.Checked && cntDefaultSect==1) { // If user unchecks this section, i.e. wants to clear it from being 'Default Step Section' // just tell user that only 1 section can be the default step section.