B2017-070 when restoring a deleted step that once had enhanced document link info, remove the link info from the step and its cautions and notes

This commit is contained in:
John Jenko 2017-03-31 18:09:09 +00:00
parent de0e7d3613
commit 1e7004b5d6

View File

@ -1630,8 +1630,20 @@ namespace VEPROMS.CSLA.Library
ContentInfo.Refresh(cctmp);
}
}
// B2017-069 when we restore a step the once had enhanced document links,
// 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);
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ItemInfo.RestoreItem", ex);
}
}
// 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)
{
XmlDocument xd = new XmlDocument();
xd.LoadXml(tmp.MyContent.Config);
XmlNode xn = xd.DocumentElement.SelectSingleNode("Enhanced");
@ -1646,13 +1658,21 @@ namespace VEPROMS.CSLA.Library
ContentInfo.Refresh(ctmp);
}
}
return tmp;
}
catch (Exception ex)
if (tmp.IsHigh)
{
throw new DbCslaException("Error on ItemInfo.RestoreItem", ex);
if (tmp.Cautions != null)
foreach (ItemInfo chld in tmp.Cautions)
{
RemoveEnhancedFromConfig(chld);
}
if (tmp.Notes != null)
foreach (ItemInfo chld in tmp.Notes)
{
RemoveEnhancedFromConfig(chld);
}
}
}
// Criteria to get Item and children
[Serializable()]
private class RestoreCriteria