B2017-209: Restoring an enhanced step whose source step is deleted causes crash

This commit is contained in:
2017-09-21 14:08:20 +00:00
parent 77c7cb6d6b
commit fbc4b42ff1
3 changed files with 18 additions and 6 deletions

View File

@@ -1632,7 +1632,7 @@ namespace VEPROMS.CSLA.Library
}
// B2017-069 when we restore a step that once had enhanced document links,
// remove the enhanced document link information - fixes delete/restore issue of linked steps.
RemoveEnhancedFromConfig(tmp);
RemoveEnhancedFromConfig(tmp, false);
return tmp;
}
catch (Exception ex)
@@ -1641,8 +1641,8 @@ namespace VEPROMS.CSLA.Library
}
}
// B2017-070 - when retoring a step that once had enhanced links, remove the link info for the notes and cautions as well
private static void RemoveEnhancedFromConfig(ItemInfo tmp)
// B2017-070 - when restoring a step that once had enhanced links, remove the link info for the notes and cautions as well
public static void RemoveEnhancedFromConfig(ItemInfo tmp, bool doOneStepOnly)
{
XmlDocument xd = new XmlDocument();
if (tmp.MyContent.Config == null || tmp.MyContent.Config == "") return; // B2017-164 & B2017-172 check for null or empty config
@@ -1660,17 +1660,18 @@ namespace VEPROMS.CSLA.Library
tmp._MyConfig = null; // refresh the memory value
}
}
if (doOneStepOnly) return;
if (tmp.IsHigh)
{
if (tmp.Cautions != null)
foreach (ItemInfo chld in tmp.Cautions)
{
RemoveEnhancedFromConfig(chld);
RemoveEnhancedFromConfig(chld, false);
}
if (tmp.Notes != null)
foreach (ItemInfo chld in tmp.Notes)
{
RemoveEnhancedFromConfig(chld);
RemoveEnhancedFromConfig(chld, false);
}
}
}

View File

@@ -884,7 +884,7 @@ namespace VEPROMS.CSLA.Library
{
// the RemoveEnhancedFromConfig method clears from the pasted step and any cautions/notes that may be off
// of the pasted step.
if (pasteItem.HasEnhancedLinkedStep) ItemInfo.RemoveEnhancedFromConfig(pasteItem);
if (pasteItem.HasEnhancedLinkedStep) ItemInfo.RemoveEnhancedFromConfig(pasteItem, false);
}
}
#endregion