From abb89cc757a08ac91e9816b6b77c9956de8e03da Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 1 Apr 2019 13:22:19 +0000 Subject: [PATCH] B2019-048: fixed crashes on approval dialog --- PROMS/VEPROMS User Interface/dlgApproveProcedure.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs index 8515495c..4670b6d6 100644 --- a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs +++ b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs @@ -11,6 +11,7 @@ using Volian.Print.Library; using System.IO; using System.Text.RegularExpressions; using DevComponents.DotNetBar; +using JR.Utils.GUI.Forms; namespace VEPROMS { @@ -219,6 +220,10 @@ namespace VEPROMS { if (key.Contains(" Checked out to ")) key = key.Substring(0, key.IndexOf(" Checked out to ")); + // B2019-048: after running consistency check - inconsistency text was added to string in dialog. Remove that text + // if in key so that it can be used to find procedure in procedure list (was crashing): + if (key.Contains(" - (")) + key = key.Substring(0, key.LastIndexOf(" - (")); if (tmpProcedures.ContainsKey(key)) return tmpProcedures[key]; else @@ -402,6 +407,12 @@ namespace VEPROMS for (int i = 0; i < clbMore.Items.Count; i++) if (clbMore.GetItemChecked(i)) myProcs.Add(GetProcedureInfoByKey(clbMore.Items[i].ToString())); + // B2019-048: if no procedures are checked in procedure list dialog, just tell user - don't crash: + if (myProcs.Count == 0) + { + FlexibleMessageBox.Show("No procedures are selected, you must select at least one procedure.", "No Procedures Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } pbMore.Maximum = myProcs.Count; _MyItemInfoList = ItemInfoList.GetMoreProcedures(myProcs); ItemInfoList.ConsistencyCheckUpdated -= new ItemInfoListCCEvent(ItemInfoList_ConsistencyCheckUpdated);