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:
parent
de0e7d3613
commit
1e7004b5d6
@ -1630,22 +1630,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
ContentInfo.Refresh(cctmp);
|
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.
|
// remove the enhanced document link information - fixes delete/restore issue of linked steps.
|
||||||
XmlDocument xd = new XmlDocument();
|
RemoveEnhancedFromConfig(tmp);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -1653,6 +1640,39 @@ namespace VEPROMS.CSLA.Library
|
|||||||
throw new DbCslaException("Error on ItemInfo.RestoreItem", 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");
|
||||||
|
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
|
// Criteria to get Item and children
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
private class RestoreCriteria
|
private class RestoreCriteria
|
||||||
|
Loading…
x
Reference in New Issue
Block a user