diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index c5016175..ce081b03 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1821,6 +1821,7 @@ namespace Volian.Controls.Library } public EditItem PasteReplace(int copyStartID) { + if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; // To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field // to simulate replacing an existing step - otherwise we will get null references. if (MyStepPanel.SelectedEditItem != null && MyStepPanel.SelectedEditItem.Empty) @@ -1844,16 +1845,21 @@ namespace Volian.Controls.Library if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved { MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo); + if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; return null; } if (newItemInfo == null) + { + if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; return this; // aborted the replace so just return to the step we were trying to replace + } } //catch (System.Data.SqlClient.SqlException ex) catch (Exception ex) { if (HandleSqlExceptionOnCopy(ex)) return this; HandleSqlExceptionOnDelete(ex); + if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; return this; } // Remove the EditItem that was the replaced item. @@ -1906,9 +1912,7 @@ namespace Volian.Controls.Library } MyStepPanel.SelectedEditItem = newEditItem; //Update Screen MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type)); - // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced. - ItemInfo newEnh = newItemInfo.PasteEnhancedItems(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Replace, GetChangeId(MyItemInfo)); - if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo); // KBR - I think this won't work for replace!! + if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; return newEditItem; } private bool HandleSqlExceptionOnCopy(Exception ex) diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs index 6e638496..d08b0d56 100644 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ b/PROMS/Volian.Controls.Library/RTBItem.cs @@ -241,7 +241,12 @@ namespace Volian.Controls.Library get { return _EnhAddFromItemInfo; } set { _EnhAddFromItemInfo = value; } } - private ItemInfo _EnhCopiedItemInfo = null; + private bool _DoingPasteReplace = false; + public bool DoingPasteReplace + { + get { return _DoingPasteReplace; } + set { _DoingPasteReplace = value; } + } #endregion #region Constructors public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) @@ -825,8 +830,13 @@ namespace Volian.Controls.Library ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.After; if (EnhAddType == EnhancedAddTypes.Before) addpart = ItemInfo.EAddpingPart.Before; else if (EnhAddType == EnhancedAddTypes.Child) addpart = ItemInfo.EAddpingPart.Child; - ItemInfo newEnh = MyItemInfo.DoAddEnhancedSteps(ed.Type, ed.ItemID, addpart); - if (newEnh != null) AddEnhancedItemToDisplayTabItem(newEnh); + // B2017-222: if replacing, don't do the enhanced links. The past replace button isn't active for enhanced, + // however, paste replace was accessed when creating a new HLS/Caution/Note and then replacing into it. + if (MyItemInfo.MyContent.Text != "" && !DoingPasteReplace) + { + ItemInfo newEnh = MyItemInfo.DoAddEnhancedSteps(ed.Type, ed.ItemID, addpart); + if (newEnh != null) AddEnhancedItemToDisplayTabItem(newEnh); + } } EnhAddType = EnhancedAddTypes.No; }