From 04a2da4371d4d993a669bda2ccede492c4df7940 Mon Sep 17 00:00:00 2001 From: mschill Date: Thu, 15 May 2025 10:45:52 -0400 Subject: [PATCH] C2025-023 Electronic Procedures - Modifications to PROMS (Phase 1) Change to not show open button if is an invalid step type --- PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs | 11 +++++++---- PROMS/Volian.Controls.Library/AnnotationDetails.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index a0dbb7a5..64be4c7e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2117,11 +2117,14 @@ namespace VEPROMS.CSLA.Library public EPFields GetValidEPFields(int AnnTypeID) { EPFields filtered = new EPFields(); - EPFields unfiltered = ActiveFormat.PlantFormat.EPFormatFiles.First(x => x.AnnotationTypeID == AnnTypeID).FieldList; + + if (ActiveFormat.PlantFormat.EPFormatFiles.Count == 0) return filtered; + if ((int)MyContent.Type < 20000) return filtered; + EPFields unfiltered = ActiveFormat.PlantFormat.EPFormatFiles.FirstOrDefault(x => x.AnnotationTypeID == AnnTypeID)?.FieldList; + if (unfiltered == null) return filtered; //Build list of step type and step type of it's parents List steptypelist = new List(); - if ((int)MyContent.Type < 20000) return filtered; int stepType = ((int)MyContent.Type) % 10000; StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList; if (stepType > sdlist.MaxIndex) @@ -2154,9 +2157,9 @@ namespace VEPROMS.CSLA.Library // C2025-023 - Electronic Procedures - Modifications to PROMS //return true if any EP Format files attached to the item's - public bool HasEPformat() + public bool HasEPformat(int AnnTypeID) { - return ActiveFormat.PlantFormat.EPFormatFiles.Count > 0; + return GetValidEPFields(AnnTypeID).Count > 0; } // determine if the the current step should automatically be placed on the Continuous Action Summary diff --git a/PROMS/Volian.Controls.Library/AnnotationDetails.cs b/PROMS/Volian.Controls.Library/AnnotationDetails.cs index c486207d..d001d92e 100644 --- a/PROMS/Volian.Controls.Library/AnnotationDetails.cs +++ b/PROMS/Volian.Controls.Library/AnnotationDetails.cs @@ -340,7 +340,7 @@ namespace Volian.Controls.Library if ((_Annotations != null) && (dgAnnotations.Rows.Count > 0)) { CurrentAnnotation = _Annotations[dgAnnotations.CurrentRow.Index]; - if (CurrentAnnotation.MyAnnotationType.IsEPAnnotationType && CurrentItem.HasEPformat()) + if (CurrentAnnotation.MyAnnotationType.IsEPAnnotationType && CurrentItem.HasEPformat(CurrentAnnotation.MyAnnotationType.TypeID)) btnEPAnnotation.Visible = true; } else