C2015-022 Separate Windows Upgrade – moved RemoveEnhancedFromConfig from AuditExt.cs

C2015-022 Separate Windows Upgrade – new call to RemoveEnhancedFromConfig
C2015-022 Separate Windows Upgrade – needed to check ProcessID instead of SessionID
This commit is contained in:
John Jenko 2018-03-12 14:34:01 +00:00
parent f87f541a16
commit 60e9131698
3 changed files with 46 additions and 5 deletions

View File

@ -1405,6 +1405,46 @@ namespace VEPROMS.CSLA.Library
} }
return level; return level;
} }
// B2017-070 - when retoring a step that once had enhanced links, remove the link info for the notes and cautions as well
public void RemoveEnhancedFromConfig()
{
RemoveEnhancedFromConfig(false);
}
public void RemoveEnhancedFromConfig(bool doOneStepOnly)
{
XmlDocument xd = new XmlDocument();
if (this.MyContent.Config == null || this.MyContent.Config == "") return; // B2017-164 & B2017-172 check for null or empty config
xd.LoadXml(this.MyContent.Config);
XmlNode xn = xd.DocumentElement.SelectSingleNode("Enhanced");
if (xn != null)
{
xn.ParentNode.RemoveChild(xn);
string config = xd.OuterXml;
using (Content ctmp = this.MyContent.Get())
{
ctmp.Config = config;
ctmp.Save();
ContentInfo.Refresh(ctmp);
_MyConfig = null; // refresh the memory value
}
}
if (doOneStepOnly) return;
if (this.IsHigh)
{
if (this.Cautions != null)
foreach (ItemInfo chld in this.Cautions)
{
chld.RemoveEnhancedFromConfig(false);
}
if (this.Notes != null)
foreach (ItemInfo chld in this.Notes)
{
chld.RemoveEnhancedFromConfig(false);
}
}
}
#endregion #endregion
public bool HasHeader public bool HasHeader
{ {

View File

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

View File

@ -173,19 +173,20 @@ namespace VEPROMS.CSLA.Library
} }
} }
bool rv = true; bool rv = true;
// C2015-022 part of separate windows logic, check the processID instead of the sessionID
foreach (SessionInfo si in sil) foreach (SessionInfo si in sil)
{ {
if (si.SessionID != this.SessionID && objectType == CheckOutType.Procedure) if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Procedure)
{ {
message = string.Format("The procedure {0} is already checked out to {1}", ItemInfo.Get(objectID).MyProcedure.DisplayNumber, si.UserID); message = string.Format("The procedure {0} is already checked out to {1}", ItemInfo.Get(objectID).MyProcedure.DisplayNumber, si.UserID);
rv = rv && false; rv = rv && false;
} }
else if (si.SessionID != this.SessionID && objectType == CheckOutType.Document) else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Document)
{ {
message = string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(objectID).DocumentEntries[0].MyContent.Text, si.UserID); message = string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(objectID).DocumentEntries[0].MyContent.Text, si.UserID);
rv = rv && false; rv = rv && false;
} }
else if (si.SessionID != this.SessionID && objectType == CheckOutType.DocVersion) else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.DocVersion)
{ {
// gets here if other session has working draft open & click on sam working draft. // gets here if other session has working draft open & click on sam working draft.
OwnerInfo oi = OwnerInfo.GetBySessionIDandVersionID(si.SessionID, objectID); OwnerInfo oi = OwnerInfo.GetBySessionIDandVersionID(si.SessionID, objectID);
@ -199,7 +200,7 @@ namespace VEPROMS.CSLA.Library
message = message + string.Format("The working draft is already checked out to {0}", si.UserID); message = message + string.Format("The working draft is already checked out to {0}", si.UserID);
rv = rv && false; rv = rv && false;
} }
else if (si.SessionID != this.SessionID && objectType == CheckOutType.Folder) else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Folder)
{ {
// gets here if other session has working draft open & click on folder above. Gets here // gets here if other session has working draft open & click on folder above. Gets here
// if other session has wd open and click on top folder - query returns empty. // if other session has wd open and click on top folder - query returns empty.