From 8601061eefb057a8f95f141ae31811c9b1239365 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 29 Apr 2020 18:23:35 +0000 Subject: [PATCH] =?UTF-8?q?B2020-062=20=E2=80=93=20Fix=20bug=20where=20the?= =?UTF-8?q?=20date/time=20prefix/suffix=20would=20automatically=20turn=20o?= =?UTF-8?q?n=20(after=20turning=20it=20off)=20when=20the=20procedure=20is?= =?UTF-8?q?=20printed.=20Also=20disabled=20the=20Date/Time=20Prefix/Suffix?= =?UTF-8?q?=20switch=20on=20the=20print=20dialog=20when=20the=20prefix/suf?= =?UTF-8?q?fix=20is=20plain=20text=20entered=20by=20the=20user.=20Original?= =?UTF-8?q?=20report=20of=20bug=20was=20that=20the=20PDF=20Links=20option?= =?UTF-8?q?=20did=20not=20work=20when=20there=20was=20a=20PDF=20file=20dat?= =?UTF-8?q?e/time=20prefix/suffix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DlgPrintProcedure.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index 6b4b1c81..d27b1844 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -149,6 +149,7 @@ namespace VEPROMS get { return cbxGenerateConActSum.Checked; } set { cbxGenerateConActSum.Checked = value; } } + private bool _CreateButtonClicked = false; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name public DlgPrintProcedure(DocVersionInfo dvi, bool automatic) { _Automatic = automatic; @@ -469,10 +470,20 @@ namespace VEPROMS string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix; string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix; string PDFFileName = ""; + PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix; + PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix; + if (dtPre != PDFDTPrefix.None) PDFFilePrefix = ""; // incase user entered prefix text but then selected a date/time (in working draft properties) + if (dtSuf != PDFDTSuffix.None) PDFFileSuffix = ""; // incase user entered suffix text but then selected a date/time (in working draft properties) + // B2020-062 control the toggle of date/time prefix/suffix on pdf file name + // disable the date/time Prefix/Suffix switch if no date/time was selected + // This switch is does not affect the use of it if the user typed in text for prefix/suffix + if (!AllowDateTimePrefixSuffix || (dtPre == PDFDTPrefix.None && dtSuf == PDFDTSuffix.None)) + { + swtbtnPDFdtPrefixSuffix.Value = false; + swtbtnPDFdtPrefixSuffix.Enabled = false; + } if (AllowDateTimePrefixSuffix && swtbtnPDFdtPrefixSuffix.Value) { - PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix; - PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix; //DateTime dts = DateTime.Now; if (dtPre != PDFDTPrefix.None) PDFFilePrefix = (_PrefixSuffixDTS.ToString(dtPre.ToString())).Replace("__", " ").Replace("_", "-") + "_"; @@ -497,6 +508,7 @@ namespace VEPROMS // C2018-033 Enable/disable the switch to control whether to add Prefix and/or Suffix to PDF file name private void SetupPrefixSuffixSwitch() { + if (_CreateButtonClicked) return; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name // note that MyProcedure must be set before calling this because BuildPDFFileName() will be called when the swbtnPDFPrefixSuffix is set string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix; string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix; @@ -947,7 +959,9 @@ namespace VEPROMS if (cbxMultiunitPdfLocation.SelectedItem != null) _MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString(); this.Cursor = Cursors.WaitCursor; + _CreateButtonClicked = true; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name CreatePDF(); + _CreateButtonClicked = false; this.Cursor = Cursors.Default; } }