B2017-060 the update of RO usages of an imported procedure, if RO was not found in the ROUsage table, the import would be aborted instead of converting the invalid RO to text

B2017-060 the update of RO usages of an imported procedure, if RO was not found in the ROUsage table, the import would be aborted instead of converting the invalid RO to text.
Part of B2017-060 fix were we need to prevent the content text from being disposed when Item is used in a Using statement.
This commit is contained in:
2017-03-24 14:29:39 +00:00
parent 95d7cbbf98
commit 8b5e7e01ad
4 changed files with 68 additions and 30 deletions

View File

@@ -3288,6 +3288,11 @@ namespace VEPROMS
_DidConvertROsToText |= true;
}
private void AddROUsages(Content content, XmlNode xn)
{
AddROUsages(content, xn, false);
}
// part of bug fix B2017-060 added the isGrid parameter
private void AddROUsages(Content content, XmlNode xn, bool isGrid)
{
if (_ConvertROsToTextDuringImport)
ConvertImportProcedureROsToText(content, xn);
@@ -3307,7 +3312,7 @@ namespace VEPROMS
if (roval == "?")
{
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst);
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst, null, rousageid); // + " " + roid);
_DidConvertROsToText |= true; // B2016-225 (follow through) add annotation when RO is converted to text
}
else
@@ -3322,9 +3327,20 @@ namespace VEPROMS
content.Text = content.Text.Replace(lookFor, replaceWith);
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst);
}
if (isGrid) // B2017-060 when importing a grid, also update the grid's xml defination
{
string glookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
string greplaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString());
if (glookFor != greplaceWith)
{
content.MyGrid.Data = content.MyGrid.Data.Replace(glookFor, greplaceWith);
}
}
}
}
content.Save();
if (isGrid)
GridInfo.Refresh(content.MyGrid); // force the updated grid (table) to refresh
}
}
@@ -3490,7 +3506,7 @@ namespace VEPROMS
if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(step.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0)
AddROUsages(step.MyContent, xc);
AddROUsages(step.MyContent, xc, true); // part of bug fix: B2017060 to properly convert invalid RO to text
if (xc.SelectNodes("transition").Count > 0)
AddTransitions(step.MyContent, xc);
prevInfo = StepInfo.Get(step.ItemID);
@@ -4062,14 +4078,7 @@ namespace VEPROMS
string ss = data.Substring(myIndex, myLength);
if (ss != newvalue)
{
int ii = data.Substring(0, mmg.Index).LastIndexOf(@"\v");
int iil = data.Substring(mmg.Index + mg.Value.Length).IndexOf(@"\v0");
string part1 = data.Substring(0, ii); // length up to \v
string part2 = data.Substring(ii + 2, mmg.Index - (ii + 2));
string part3 = ss;
string part4 = data.Substring(mmg.Index + mg.Value.Length, iil);
string part5 = data.Substring(mmg.Index + (mg.Value.Length + iil + 3));
data = part1 + part2 + part3 + part4 + part5;
data = Content.ConvertGridROsToText(data, mmg, mg, ss); // part of bug fix: B2017060 to properly convert invalid RO to text
}
}
}
@@ -4098,6 +4107,7 @@ namespace VEPROMS
content.MyGrid = gg;
}
// jsj 4-29-2016 appears to not be used
//private Dictionary<string, string> AddEntry(XmlReader xr)
//{