From 7164ae98ef5be9fe3c10861c4b72b9e3d1d2f9ad Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 7 Mar 2018 19:04:32 +0000 Subject: [PATCH] B2018-043 The code to fix Invalid Transitions in procedure text was getting hung in an infinite loop in the Admin Tools or when these step were opened in the editor. I added some code to exit from the loop if some of the tokens are missing. --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index d0c2c1a2..35ce5f77 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -739,6 +739,24 @@ namespace VEPROMS.CSLA.Library content.ConvertTransitionToTextInGrid(null, null); content.Save(); } + else // B2018-043 Eliminate infinite loop for invalid transition structure + { + bool hasAnnotation = false; + AnnotationType myType = AnnotationType.GetByNameOrCreate("Link Converted To Text"); + foreach (AnnotationInfo anot in itemInfo.ItemAnnotations) + { + if (anot.TypeID == myType.TypeID && anot.SearchText == "Invalid Transition Format") + hasAnnotation = true; + } + if (!hasAnnotation) + { + using (Item myItem = itemInfo.Get()) + { + Annotation.MakeAnnotation(myItem, myType, "", "Invalid Transition Format", null); + } + } + break; + } } } }