Merge pull request 'B2023-101 & 102: Incoming Transition & Copy/Paste Replace with Incoming Transitionis crashes' (#134) from GenWork into Development

Passed code review.  OK to generate test executable.
This commit is contained in:
John Jenko 2023-10-12 09:12:16 -04:00
commit 928fba3b37
2 changed files with 23 additions and 3 deletions

View File

@ -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);

View File

@ -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<int> 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();