C2015-022 Separate Windows Upgrade – moved RemoveEnhancedFromConfig to ItemExt.cs

This commit is contained in:
John Jenko 2018-03-12 14:32:39 +00:00
parent 400ef655c7
commit f87f541a16

View File

@ -1632,7 +1632,8 @@ 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, false);
// B2017-070 - when retoring a step that once had enhanced links, remove the link info for the notes and cautions as well
tmp.RemoveEnhancedFromConfig();
return tmp;
}
catch (Exception ex)
@ -1641,42 +1642,6 @@ namespace VEPROMS.CSLA.Library
}
}
// 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
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);
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, false);
}
if (tmp.Notes != null)
foreach (ItemInfo chld in tmp.Notes)
{
RemoveEnhancedFromConfig(chld, false);
}
}
}
// Criteria to get Item and children
[Serializable()]
private class RestoreCriteria
{