diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index 6b469f29..34b307ee 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -2508,11 +2508,28 @@ namespace VEPROMS.CSLA.Library firstTrans = false; if (!CanDeleteObject()) throw new System.Security.SecurityException("User not authorized to remove a Item"); + // B2016-009 check source and desintation types and display message box if needed + // C2022-017 moved the CheckSourceDestinationType call to btnPasteReplace_Click in StepTabRibbon + // B2023-101 Handle Paste Replace when procedure to be replaced has Incoming Transitions, i.e. do a separate try/catch for this case + ItemInfo newItemInfo = null; + try + { + newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type); + if (newItemInfo == null) return null; + } + catch (Exception ex1) + { + if (ex1.Message.Contains("has External Transitions and has no next step") + || ex1.Message.Contains("has External Transitions to Procedure") + || ex1.Message.Contains("has External Transitions to it's children")) + + { + FlexibleMessageBox.Show("This procedure has external transition references to it that must be resolved before doing the Paste/Replace.\r\nRight Click on the procedure and select the Incoming Transitions menu option to find these references and resolve them.", "Paste Replace Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); + return null; + } + } try { - // B2016-009 check source and desintation types and display message box if needed - // C2022-017 moved the CheckSourceDestinationType call to btnPasteReplace_Click in StepTabRibbon - ItemInfo newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type); // Delete business objects, including remove from tree ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item); diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 9f0d5402..b41df472 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -1134,6 +1134,9 @@ namespace Volian.Controls.Library // C2020-033: Before allowing conversion of Incoming Transitions to text, get list of results that the user has permission edit. private List TranCvtCheckPermission(bool all) { + // B2023-102 Don't crash on converting incoming transitions to text if there are none (can happen if 2nd pass occurs) + if (_SearchResults == null) return null; + // check if a non-reader can convert transitions to text even if a reader - this is set by an administrator on the top // folder properties dialog bool allowNonAdmin = IncTranCvtPerm();