From 33881adca570b185fcb91352835e5eb9738352b6 Mon Sep 17 00:00:00 2001 From: Kathy Ruffing Date: Tue, 14 Nov 2023 08:51:39 -0500 Subject: [PATCH] B2022-072: Unit Designators not resolve on import of procedure set --- PROMS/VEPROMS User Interface/dlgExportImport.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 139a5b5a..7a44c9ba 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -2001,19 +2001,34 @@ namespace VEPROMS Application.DoEvents(); string formatFileName = (dvi.MyFormat != null) ? dvi.MyFormat.Name : ""; XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + + // B2022-072: if the exported docversion doesn't have the format set, look up folder tree to find the format used + int tmpFormatID = (dvi.FormatID != null) ? (int)dvi.FormatID : 0; + FolderInfo fi = dvi.MyFolder; + while (formatFileName == "" && fi != null) + { + if (fi.FormatID != null && fi.FormatID != 0) + { + formatFileName = (fi.MyFormat != null) ? fi.MyFormat.Name : ""; + tmpFormatID = (fi.FormatID != null) ? (int)fi.FormatID : 0; + break; + } + fi = fi.MyParent; + } xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "versionid", dvi.VersionID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "folderid", dvi.FolderID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "versiontype", dvi.VersionType.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", dvi.Name)); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "title", dvi.Title)); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", dvi.ItemID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", dvi.FormatID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", tmpFormatID.ToString()));//dvi.FormatID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", dvi.Config)); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", dvi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", dvi.UserID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatfilename", formatFileName)); xn.AppendChild(xe); if (!ValidDocVersionAssociation(dvi)) return; // bug fix: B2017-082 don't export if no RO Path + if (dvi.DocVersionAssociationCount > 0) foreach (AssociationInfo ai in dvi.DocVersionAssociations) ExportAssociation(xe, ai, "association");