diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 07ea20f4..cee6bbca 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -5793,6 +5793,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI join Contents C on C.ContentID = I.ContentID where i.apple = 1 order by I.[Level] , I.[FromType], I.[Ordinal] + OPTION (MAXRECURSION 10000) END GO -- Display the status of Procedure Creation diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index 0a4d1cce..d6512b48 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -26,6 +26,17 @@ namespace VEPROMS cbxDebugPagination.Checked = true; cbxDebugText.Checked = true; Application.DoEvents(); + string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray()); + bool ranAuto = false; + foreach (string parameter in parameters) + { + if (parameter.ToUpper() == "/NT") + cbxDebugText.Checked = false; + else if (parameter.ToUpper() == "/NP") + cbxDebugPagination.Checked = false; + else if (parameter.ToUpper() == "/NC") + cbxDebug.Checked = false; + } CreatePDFs(); this.Close(); } @@ -566,6 +577,7 @@ namespace VEPROMS newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_Text; if (_MultiunitPdfLocation == "Unit ID") newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_ID; + if (newPDFPath == "") newPDFPath = Volian.Base.Library.VlnSettings.TemporaryFolder; if (!Directory.Exists(newPDFPath)) Directory.CreateDirectory(newPDFPath); return newPDFPath; diff --git a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs index ba311356..e28f8751 100644 --- a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs +++ b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs @@ -341,10 +341,16 @@ namespace VEPROMS btnApplicability.Visible = false; tiApplicability.Visible = false; } + ppTxtBxPDFLoc.TextChanged += new EventHandler(ppTxtBxPDFLoc_TextChanged); //end add new applicability stuff _Initializing = false; } - + // The following code was added to fix Bug B2013-117 + void ppTxtBxPDFLoc_TextChanged(object sender, EventArgs e) + { + if (_Initializing == false) + _DocVersionConfig.Print_PDFLocation = ppTxtBxPDFLoc.Text; + } #region General tab /// diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 220b4cd5..f54723e0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -34,6 +34,16 @@ namespace VEPROMS.CSLA.Library return _LibTitle; } } + private static LBApplicationClass _MyApp = null; + public static LBApplicationClass MyApp + { + get + { + if (_MyApp == null) + _MyApp = new LBApplicationClass(); + return _MyApp; + } + } public void UpdateDRoUsages(List roids) { _DocumentDROUsageCount = -1; @@ -57,6 +67,94 @@ namespace VEPROMS.CSLA.Library DocumentDROUsages.Add(parts[1], RODb.GetJustRoDb(int.Parse(parts[0]))); } } + private int _Unique = 0; + private string Unique + { + get + { + string retval = ""; + if (_Unique != 0) retval = "_" + _Unique.ToString(); + _Unique++; + return retval; + } + } + public void StatusChanged(VolianStatusType type, int count, string text) + { + //if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl) + //{ + // DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl; + // tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text)); + //} + } + public void RestoreWordDoc(ItemInfo myItemInfo) + { + DocumentAuditInfo savDocAuditInfo = null; + using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(DocID)) + { + if (dail.Count > 0) + { + DocumentAuditInfo dai = dail[0]; + foreach (DocumentAuditInfo tmpa in dail) + { + FileInfo tmpFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, DocID, Unique, tmpa.FileExtension)); + while (tmpFile.Exists) + { + tmpFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, DocID, Unique, tmpa.FileExtension)); + } + FileStream fs = tmpFile.Create(); + if (tmpa.DocContent != null) fs.Write(tmpa.DocContent, 0, tmpa.DocContent.Length); + fs.Close(); + LBDocumentClass myDoc = null; + try + { + myDoc = MyApp.Documents.Open(tmpFile.FullName, false); + savDocAuditInfo = tmpa; + myDoc.Close(); + break; + } + catch (Exception ex) + { + if (myDoc != null) myDoc.Close(); + continue; // get next document audit item. + } + } + } + if (savDocAuditInfo != null) + { + FileExtension = savDocAuditInfo.FileExtension; + DocContent = savDocAuditInfo.DocContent; + DocAscii = savDocAuditInfo.DocAscii; + Config = savDocAuditInfo.Config; + UserID = savDocAuditInfo.UserID; + DTS = savDocAuditInfo.DTS; + Save(); + List roids = new List(); + DocumentInfo docinfo = DocumentInfo.Get(DocID); + + string pdfTmp = MSWordToPDF.ToPDFReplaceROs(docinfo, roids, myItemInfo, StatusChanged); + FileInfo pdfFile = new FileInfo(pdfTmp); + FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + Byte[] buf = new byte[pdfFile.Length]; + fs.Read(buf, 0, buf.Length); + fs.Close(); + pdfFile.Delete(); + Pdf.DeleteAll(DocID); // clear the PDF table for DocID first + DocStyle myDocStyle = myItemInfo.ActiveSection.MyDocStyle; + SectionConfig sc = myItemInfo.ActiveSection.MyConfig as SectionConfig; + if (sc != null && sc.Section_WordMargin == "Y") + { + using (Pdf myPdf = Pdf.MakePdf(this, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)myItemInfo.MSWordPageCount, buf)) { ;} + } + else + { + using (Pdf myPdf = Pdf.MakePdf(this, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, + (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;} + } + UpdateDRoUsages(roids); + Save(); + } + } + } /// /// FixString processes the string returned and changes any symbols (0xF0??) to normal characters /// @@ -417,7 +515,8 @@ namespace VEPROMS.CSLA.Library cfg.Edit_Initialized = true; doc.Config = cfg.ToString(); doc.UserID = Volian.Base.Library.VlnSettings.UserID; - doc.DTS = _MyFile.LastWriteTimeUtc; + //doc.DTS = _MyFile.LastWriteTimeUtc; + doc.DTS = DateTime.Now.ToUniversalTime(); doc = doc.Save(); List roids = new List(); string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo,statusChange); @@ -658,7 +757,7 @@ namespace VEPROMS.CSLA.Library LBRange myRange = selxy.Paragraphs.First.Range; float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage); float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary); - + // some data had regular text embedded in the xyplot definition. If so, the plain text must // be left in the file. Otherwise, we can replace with empty text. string resXyPlot = xyplot; @@ -670,8 +769,8 @@ namespace VEPROMS.CSLA.Library } else { - selxy.Text = ""; - if (cnt>0)for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r"; + selxy.Text = ""; + if (cnt > 0) for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r"; } pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png"; @@ -694,6 +793,9 @@ namespace VEPROMS.CSLA.Library if(statusChange != null) statusChange(VolianStatusType.Initialize, sel.End, "Refreshing ROs"); sel = hasRos ? FindRO() : null; int roCount = 0; + // force Print of MS Word Attachment to Final without revisions and comments + myDoc.ActiveWindow.View.ShowRevisionsAndComments = false; + myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal; while (sel != null) { if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount)); @@ -817,9 +919,6 @@ namespace VEPROMS.CSLA.Library //sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); sel.Range.Font.Color = (LBWdColor)WordColor(OverrideColor == System.Drawing.Color.Transparent ? System.Drawing.Color.Black : OverrideColor); sect.MSWordPageCount = myDoc.Length; - // force Print of MS Word Attachment to Final without revisions and comments - myDoc.ActiveWindow.View.ShowRevisionsAndComments = false; - myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal; fileName = CreatePDF(fileName, openPdf); MyApp.ActiveDocument.Close(false); if (CloseWordWhenDone) @@ -987,7 +1086,7 @@ namespace VEPROMS.CSLA.Library , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath); } else - _MyLog.Error("Could not set margins", ex); + _MyLog.Error("Could not set margins", ex); } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index f6c29114..1d7aed22 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -4730,7 +4730,7 @@ namespace VEPROMS.CSLA.Library string tmpstr = indx+1= 0) return -1; + if (tmpstr != null && tmpstr.IndexOf('-') >= 0) return -1; return tmpstr==null?0:System.Convert.ToInt32(tmpstr); } return (-1); diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/DocumentAuditInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/DocumentAuditInfo.cs index 594606a0..bb2d64b8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/DocumentAuditInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/DocumentAuditInfo.cs @@ -180,16 +180,6 @@ namespace VEPROMS.CSLA.Library return _FileExtension; } } - private byte[] _DocPdf; - public byte[] DocPdf - { - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] - get - { - CanReadProperty("DocPdf", true); - return _DocPdf; - } - } private int _DeleteStatus; public int DeleteStatus { @@ -281,7 +271,6 @@ namespace VEPROMS.CSLA.Library _DTS = tmp.DTS; _UserID = tmp.UserID; _FileExtension = tmp.FileExtension; - _DocPdf = tmp.DocPdf; _DeleteStatus = tmp.DeleteStatus; _DocumentAuditInfoExtension.Refresh(this); OnChange();// raise an event @@ -350,7 +339,6 @@ namespace VEPROMS.CSLA.Library _DTS = dr.GetDateTime("DTS"); _UserID = dr.GetString("UserID"); _FileExtension = dr.GetString("FileExtension"); - _DocPdf = (byte[])dr.GetValue("DocPdf"); _DeleteStatus = dr.GetInt32("DeleteStatus"); } catch (Exception ex) diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs index b883cf40..5bba3efc 100644 --- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs +++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs @@ -90,9 +90,11 @@ namespace Volian.Controls.Library //private frmPG _frm = null; #region Constructors private Timer _RefreshTimer; - public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl) + private ItemInfo _ItemInfo; + public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo) { _MyDisplayTabControl = myDisplayTabControl; + _ItemInfo = itemInfo; InitializeComponent(); SetupDSOTabPanel(); _MyDocumentInfo = documentInfo; @@ -159,14 +161,23 @@ namespace Volian.Controls.Library { if (dail.Count > 0) { - DocumentAuditInfo dai = dail[0]; - foreach (DocumentAuditInfo tmpa in dail) - { - if (tmpa.DTS > dai.DTS) dai = tmpa; - } + //DocumentAuditInfo dai = dail[0]; + //foreach (DocumentAuditInfo tmpa in dail) + //{ + // if (tmpa.DTS > dai.DTS) dai = tmpa; + //} if(MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section", MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes) - fs.Write(dai.DocContent, 0, dai.DocContent.Length); + { + //fs.Write(dai.DocContent, 0, dai.DocContent.Length); + using (Document myDoc = Document.Get(MyDocumentInfo.DocID)) + { + myDoc.RestoreWordDoc(_ItemInfo); + _DSOFile = null; + _MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID); + } + } + } else MessageBox.Show("Reverting to Blank Document", "Error in MS Word section", @@ -175,7 +186,20 @@ namespace Volian.Controls.Library fs.Close(); this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName); } - this._MyDSOFramer.Menubar = false; + LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); + Console.WriteLine("Version {0}", doc.Application.Version); + float ver; + if (!float.TryParse(doc.Application.Version, out ver)) + ver = 12.0F; + this._MyDSOFramer.Menubar = ver < 12.0F; + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileClose, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileNew, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePageSetup, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrint, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrintPreview, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileProperties, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSave, false); + this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSaveAs, false); this._MyDSOFramer.Titlebar = false; //if (_MyCount < 20) // this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow; @@ -191,7 +215,6 @@ namespace Volian.Controls.Library //this.GotFocus += new EventHandler(DSOTabPanel_GotFocus); //this.LostFocus += new EventHandler(DSOTabPanel_LostFocus); Application.DoEvents(); - LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); // The following line corrects Symbol characters in MSWord Sections // CheckForSymbolCharacters(doc); InitializeWordDocument(doc); @@ -364,6 +387,8 @@ namespace Volian.Controls.Library return; } LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); + while (doc.Saved = false) + Application.DoEvents(); string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); if (System.IO.File.Exists(tmp)) MyDSOFile.FullName = tmp; diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs index ec17a0db..4f81fda0 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabItem.cs @@ -204,7 +204,7 @@ namespace Volian.Controls.Library private void SetupDSOTabPanel() { EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry; - _MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl); + _MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo); // // tabItem // @@ -228,7 +228,7 @@ namespace Volian.Controls.Library } private void SetupLibraryDocumentDSOTabPanel() { - _MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl); + _MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo); // // tabItem // diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index f9261507..bec930e8 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -248,6 +248,7 @@ namespace Volian.Controls.Library } // Find sameParent1 in tree, expand down to toItem: + if (tvTran.Nodes.Count == 0) return; tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev1, true); path.Clear(); parRng = rngItem; diff --git a/PROMS/fmtxml/WST1all.xml b/PROMS/fmtxml/WST1all.xml index 70804e31..c4d2ea5b 100644 Binary files a/PROMS/fmtxml/WST1all.xml and b/PROMS/fmtxml/WST1all.xml differ diff --git a/PROMS/fmtxml/WST2all.xml b/PROMS/fmtxml/WST2all.xml index f2dded2a..feef8d27 100644 Binary files a/PROMS/fmtxml/WST2all.xml and b/PROMS/fmtxml/WST2all.xml differ diff --git a/PROMS/fmtxml/WSTALRall.xml b/PROMS/fmtxml/WSTALRall.xml index 89163fea..1d9c25e0 100644 Binary files a/PROMS/fmtxml/WSTALRall.xml and b/PROMS/fmtxml/WSTALRall.xml differ diff --git a/PROMS/fmtxml/WSTBCKall.xml b/PROMS/fmtxml/WSTBCKall.xml index 46450e19..29553494 100644 Binary files a/PROMS/fmtxml/WSTBCKall.xml and b/PROMS/fmtxml/WSTBCKall.xml differ