B2020-095 Don’t display the dialog asking if ROs should be converted to text, when an Approved procedure export file is imported.

This commit is contained in:
John Jenko 2020-07-28 19:37:41 +00:00
parent daa87765d1
commit cbc2adf712

View File

@ -374,9 +374,9 @@ namespace VEPROMS
string msg1 = (_DidConvertTransitionsToText && _DidConvertROsToText) ? "Transitions and Referenced Objects" : (_DidConvertTransitionsToText) ? "Transitions" : "Referenced Objects";
msg += string.Format("\n\n{0} converted to text.\n\nThe locations can be found by doing a Global Search for the \"Link Converted To Text\" annotation type", msg1);
}
else if (!_DidProcessTransitions && !_DidProcessROs) // B2017-076 Approved import file does not have ROs nor Transitions
else if (_ImportingApprovedExportFile) // B2020-095 An approved version of a procedure was imported, all ROs and Transitions are unlinked.
{
msg += "\n\nAll Transition and Referenced Object values are text.\n\nThere either were none or you had imported an Approved procedure.";
msg += "\n\nYou had imported an Approved Version of a procedure.\n\nAll Transition and Referenced Object values are text."; // B2017-076 Approved import file does not have ROs nor Transition
}
// B2016-225 added more information to the finish import message to tell the user when ROs or Transitions are converted to text.
MessageBox.Show(msg, "Import", MessageBoxButtons.OK, MessageBoxIcon.Information);
@ -476,8 +476,20 @@ namespace VEPROMS
return false;
}
}
// B2020-095 exported files generated from approval has "APPROVED_REV_" in the file name
// if found, then sent the ImportingApprovedExportFile flag to true.
private bool _ImportingApprovedExportFile = false;
private bool ImportingApprovedExport(string fnAndPath)
{
bool rtnval = false;
int idx = fnAndPath.LastIndexOf("//") + 1;
string tmp = fnAndPath.Substring(idx);
rtnval = tmp.ToUpper().Contains("APPROVED_REV_");
return rtnval;
}
private bool ImportProcedure(ref bool isImported, ref bool canceledPressed)
{
_ImportingApprovedExportFile = ImportingApprovedExport(txtImport.Text); //B2020-095 see if import file was generated from Approved (versions) menu
XmlDocument xd = new XmlDocument();
xd.Load(txtImport.Text);
pbImportProcedure.Maximum = 1;
@ -499,7 +511,7 @@ namespace VEPROMS
MyRODb = RODb.GetJustRoDb(MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.RODbID);
// if the current RO Path and the import file RO Path are not the same
// then ask if we should import using the current workingdraft RO Path, convert the ROs to text, or cancel the import
if (MyRODb.FolderPath != rofolderpath)
if (MyRODb.FolderPath != rofolderpath && !_ImportingApprovedExportFile) //B2020-095 don't display dialog if importing approved procedure export file
{
dlgImpHowToHandleROs dlg = new dlgImpHowToHandleROs();
dlg.ImportedROFolder = rofolderpath;
@ -3862,6 +3874,7 @@ namespace VEPROMS
// part of bug fix B2017-060 added the isGrid parameter
private void AddROUsages(Content content, XmlNode xn, bool isGrid)
{
if (_ImportingApprovedExportFile) return; //B2020-095 the links are already removed from the import file
_DidProcessROs = false;
if (_ConvertROsToTextDuringImport)
ConvertImportProcedureROsToText(content, xn);