B2019-992: Changing transition type has missing section text

This commit is contained in:
Kathy Ruffing 2019-06-04 14:43:18 +00:00
parent b3c58ea2b2
commit f41a41c2ed

View File

@ -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.