diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs index e658fefe..8df544e9 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs @@ -1630,22 +1630,9 @@ 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. - XmlDocument xd = new XmlDocument(); - xd.LoadXml(tmp.MyContent.Config); - XmlNode xn = xd.DocumentElement.SelectSingleNode("Enhanced"); - if (xn != null) - { - xn.ParentNode.RemoveChild(xn); - string config = xd.OuterXml; - using (Content ctmp = tmp.MyContent.Get()) - { - ctmp.Config = config; - ctmp.Save(); - ContentInfo.Refresh(ctmp); - } - } + RemoveEnhancedFromConfig(tmp); return tmp; } catch (Exception ex) @@ -1653,6 +1640,39 @@ namespace VEPROMS.CSLA.Library 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"); + if (xn != null) + { + xn.ParentNode.RemoveChild(xn); + string config = xd.OuterXml; + using (Content ctmp = tmp.MyContent.Get()) + { + ctmp.Config = config; + ctmp.Save(); + ContentInfo.Refresh(ctmp); + } + } + if (tmp.IsHigh) + { + 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