diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index 5d39a5e0..602b5422 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -1638,7 +1638,7 @@ namespace VEPROMS.CSLA.Library // get the first enhanced section, there may be non-linked sections before first linked section: SectionConfig firstEnhSectionConfig = pastedEnhancedProc.Sections == null ? null : pastedEnhancedProc.Sections[0].MyConfig as SectionConfig; ItemInfo pastedEnhancedCurrentSection = null; - if (firstEnhSectionConfig.MyEnhancedDocuments.Count > 0) pastedEnhancedCurrentSection = pastedEnhancedProc.Sections[0]; + if (firstEnhSectionConfig?.MyEnhancedDocuments.Count > 0) pastedEnhancedCurrentSection = pastedEnhancedProc.Sections[0]; else pastedEnhancedCurrentSection = GetNextEnhancedSection(pastedEnhancedProc.Sections[0]); // newly pasted procedure has sections/steps, need to adjust 'MyEnhancedDocuments' config items to point to correct @@ -1647,7 +1647,7 @@ namespace VEPROMS.CSLA.Library foreach (ItemInfo sourceSect in Sections) { SectionConfig srcCfg = sourceSect.MyConfig as SectionConfig; - if (srcCfg != null && (srcCfg.Section_LnkEnh=="Y" || srcCfg.Section_LnkEnh=="T") && srcCfg.MyEnhancedDocuments != null && srcCfg.MyEnhancedDocuments.Count > 0) + if (srcCfg != null && (srcCfg.Section_LnkEnh != "N") && srcCfg.MyEnhancedDocuments != null && srcCfg.MyEnhancedDocuments.Count > 0) { // use pastedEnhancedCurrentSection to link to: foreach (EnhancedDocument ed in srcCfg.MyEnhancedDocuments) @@ -1664,7 +1664,7 @@ namespace VEPROMS.CSLA.Library enhSectCfg.MyEnhancedDocuments[0].ItemID = sourceSect.ItemID; enhSectCfg.SaveEnhancedDocuments(); pastedEnhancedCurrentSection.SaveConfig(enhSectCfg.ToString()); - if (srcCfg.Section_LnkEnh == "Y") EnhancedSetStepLinks(sourceSect, enhProc.Type); //if steps, do them for this type + if (srcCfg.Section_LnkEnh != "T") EnhancedSetStepLinks(sourceSect, enhProc.Type); //if steps, do them for this type pastedEnhancedCurrentSection = GetNextEnhancedSection(pastedEnhancedCurrentSection); } }