diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index 5fc5bd8a..c3a5ace2 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -932,7 +932,8 @@ namespace VEPROMS.CSLA.Library // get the item object in the enhanced document so that inserting of the new enhanced item and // its children can be done: ItemInfo existingEnhancedItemInfo = ItemInfo.Get(enhItemID); - ItemInfo newEnhancedItemInfo = existingEnhancedItemInfo.InsertEnhancedSteps(MyContent.Text, null, addpart, MyContent.Type, enhType, ItemID); + int type = GetEnhancedTypeForAdd(); // B2018-115: use the correct step type for the add. + ItemInfo newEnhancedItemInfo = existingEnhancedItemInfo.InsertEnhancedSteps(MyContent.Text, null, addpart, type, enhType, ItemID); if (newEnhancedItemInfo == null) return null; StepConfig sc = new StepConfig(MyContent.Config); sc.AddEnhancedDocument(enhType, newEnhancedItemInfo.ItemID); @@ -1020,10 +1021,7 @@ namespace VEPROMS.CSLA.Library } else { - // if 'type' is high level, use standard hls as type. - // if 'type' is caution/note, use the base caution/note for 'type' - int ltype = IsHigh ? 20002 : (IsNote ? 20007 : 20006); - tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, ltype, newSourceID); + tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, (int)type, newSourceID); } if (tmp == null) return null; @@ -1625,11 +1623,16 @@ namespace VEPROMS.CSLA.Library { ItemInfo exEnh = ItemInfo.Get(edSource.ItemID); int enhType = (int)MyContent.Type; - // B2017-272 did not need the if-check to set the enhanced type (commented it out) - //if (iiCur.MyContent.Type == MyContent.Type) // B2017-134 the enhanced section was being created with the wrong document type creating new enhanced section from EOP (bryon data) + // B2017-272 did not need the if-check to set the enhanced type (commented it out) + //if (iiCur.MyContent.Type == MyContent.Type) // B2017-134 the enhanced section was being created with the wrong document type creating new enhanced section from EOP (bryon data) enhType = (int)exEnh.MyContent.Type; if (exEnh.IsStep) - newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype,enhType, edSource.Type, this.ItemID); + { + // B2018-115: use the correct step type for the add. + // if coming from a HLS, note or caution, the enhanced type should be the base hls/note/caution type (from GetEnhancedTypeForAdd) + enhType = GetEnhancedTypeForAdd(); + newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, enhType, edSource.Type, this.ItemID); + } else newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, enhType, edSource.Type, this.ItemID); } @@ -1648,11 +1651,16 @@ namespace VEPROMS.CSLA.Library { ItemInfo exEnh = ItemInfo.Get(edSource.ItemID); int enhType = (int)MyContent.Type; - // B2017-272 did not need the if-check to set the enhanced type (commented it out) - //if (iiNxt != null && iiNxt.MyContent.Type == MyContent.Type) // B2017-134 the enhanced section was being created with the wrong document type creating new enhanced section from EOP (byron data) (B2017-174: added null check) - enhType = (int)exEnh.MyContent.Type; + // B2017-272 did not need the if-check to set the enhanced type (commented it out) + //if (iiNxt != null && iiNxt.MyContent.Type == MyContent.Type) // B2017-134 the enhanced section was being created with the wrong document type creating new enhanced section from EOP (byron data) (B2017-174: added null check) + enhType = (int)exEnh.MyContent.Type; if (exEnh.IsStep) + { + // B2018-115: use the correct step type for the add. + // if coming from a HLS, note or caution, the enhanced type should be the base hls/note/caution type (from GetEnhancedTypeForAdd) + enhType = GetEnhancedTypeForAdd(); newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, enhType, edSource.Type, this.ItemID); + } else newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, enhType, edSource.Type, this.ItemID); } @@ -1702,7 +1710,12 @@ namespace VEPROMS.CSLA.Library { ItemInfo exEnh = ItemInfo.Get(edSource.ItemID); if (exEnh.IsStep) - newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); + { + // B2018-115: use the correct step type for the add. + // if coming from a HLS, note or caution, the enhanced type should be the base hls/note/caution type (from GetEnhancedTypeForAdd) + int enhType = GetEnhancedTypeForAdd(); + newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, enhType, edSource.Type, this.ItemID); + } else newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, MyContent.Type, edSource.Type, this.ItemID); break; @@ -1736,6 +1749,16 @@ namespace VEPROMS.CSLA.Library } return newEnh; } + + private int GetEnhancedTypeForAdd() + { + // B2018-115: use the correct step type for the add. + // When creating steps in the enhanced, use the type from the source & then get the 'base' (non-herited) type for HLS/Caution/Note + int enhType = 20002; + if (IsNote) enhType = 20007; + if (IsCaution) enhType = 20006; + return enhType; + } public void DoCreateLinksEnhancedSingleItem(ItemInfo enhii, int enhtype) { // Link the 2 items, srcII & enhii: