B2020-062 – Fix bug where the date/time prefix/suffix would automatically turn on (after turning it off) when the procedure is printed. Also disabled the Date/Time Prefix/Suffix switch on the print dialog when the prefix/suffix is plain text entered by the user. Original report of bug was that the PDF Links option did not work when there was a PDF file date/time prefix/suffix.

This commit is contained in:
John Jenko 2020-04-29 18:23:35 +00:00
parent 8d9d19db7d
commit 8601061eef

View File

@ -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 = "";
if (AllowDateTimePrefixSuffix && swtbtnPDFdtPrefixSuffix.Value)
{
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)
{
//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;
}
}