From 07212ffe7782657c117fa21b5d2815446c313ebd Mon Sep 17 00:00:00 2001 From: John Date: Tue, 21 Feb 2023 16:22:06 +0000 Subject: [PATCH] =?UTF-8?q?B2023-015=20Added=20Print=5FViewableStartingCha?= =?UTF-8?q?ngeBarDate=20will=20get=20date=20only=20if=20user=20overrode=20?= =?UTF-8?q?from=20context=20menu=20of=20the=20procedure=20=E2=80=93=20used?= =?UTF-8?q?=20in=20HasChanges=20in=20itemExt.cs=20B2023-015=20added=20chec?= =?UTF-8?q?k=20for=20user=20override=20of=20the=20date=20to=20start=20show?= =?UTF-8?q?ing=20change=20bars.=20Logic=20needed=20to=20handle=20when=20pr?= =?UTF-8?q?inting=20Child=20procedures.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VEPROMS.CSLA.Library/Config/ProcConfig.cs | 22 ++++++++++++++++++- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 9 +++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs index 65c45fa9..adb5dd7b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs @@ -411,7 +411,27 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Print_RevDate"); } } - //new changebar_date + [Category("Print Settings")] + [Browsable(false)] + [DisplayName("User Selected ChangeBarDate View")] + [RefreshProperties(RefreshProperties.All)] + [Description("The view change bars starting date stored in ChangeBarDate")] + // B2023-015 this allows us to better determine if a change bar should be view/printed for child (slave) procedures + // when the user selects view change bars starting date, it's stored in the procedure config under "ChangeBarDate" + // (see the Set for Print_ChangeBarDate) + public DateTime? Print_ViewableStartingChangeBarDate + { + get + { + DateTime? dt = null; + string s = _Xp["Procedure", "ChangeBarDate"]; + if (s!= null && s!="") + dt = DateTime.Parse(s); + return dt; + } + } + + //new changebar_date [Category("Print Settings")] //Note that this print setting is stored under 'Procedure' element [Browsable(false)] [DisplayName("Revision ChangeBarDate")] diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index c1621f55..ad6c9c02 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -3634,7 +3634,14 @@ namespace VEPROMS.CSLA.Library if (ii == null) return false; // when deleting a source step, this was causing a crash (null ii) return (ii.MyContent.DTS > MyProcedure.ChangeBarDate); } - // if there is no override & return whether there was a change to the text. + // B2023-015 When user sets PROMS to show changebars after a specific date, we store that in the procedure config to Print_ChangeBarDate + // (ProcConfig.cs), but it actually get saved to "ChangeBarDate". Also when we get the value of Print_ChangeBarDate when processing a + // Child (slave), it returns the ChangeBarDate of the child instead of the date set by the user (to show change bars after a specific + // date). Print_ViewableAfterChangeBarDate was created to get only that user specified date, if it exists. If it does exist, we compare + // that with the Content datetime, otherwise we proceed as before. + DateTime? viewableStartingDateTime = (MyProcedure.MyConfig as ProcedureConfig).Print_ViewableStartingChangeBarDate; + if (viewableStartingDateTime != null && viewableStartingDateTime > MyProcedure.ChangeBarDate) + return (MyContent.DTS > viewableStartingDateTime); return (MyContent.DTS > MyProcedure.ChangeBarDate); } }