From 925f18d7fbc1a466a05cd82151e7150d943e5e3e Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 15 Nov 2013 14:09:45 +0000 Subject: [PATCH] Handle transitions to Dummy Steps (Created when errors are found during migration.) Added ErrorLog output for invalid transitions when printing. Invalid transitions include transitions from generic steps (Applicable to All) with a destination step which is not applicable to all. Invalid transitions also include transitions from steps with one applicability to destination step with different applicability. Valid transitions include generic to generic or between steps with the same applicabilty, or from a specific applicability to a generic step. --- PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs | 6 ++++++ PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index e85051ea..fbc49538 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -4541,6 +4541,12 @@ namespace VEPROMS.CSLA.Library public static ProcedureInfo GetNewLookup(object sender, TransitionLookupEventArgs args) { ProcedureInfo tmp = DataPortal.Fetch(new ItemAndChildrenByUnitCriteria(args.ProcID, 0, args.UnitID)); + if (tmp.MyDocVersion != null) + { + tmp.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitID; + (tmp.MyConfig as ProcedureConfig).SelectedSlave = args.UnitID; + ItemInfo.SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion); + } return tmp; } // Criteria to get Item and children by unit diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index 1e0ae880..d53f0f4b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -71,8 +71,8 @@ namespace VEPROMS.CSLA.Library tranLookup.AddProcLookup(myItemToID.MyProcedure.ItemID, ProcedureInfo.GetNewLookup(tranLookup, new TransitionLookupEventArgs(myItemToID.MyProcedure.ItemID, tranLookup.ApplicabilityUnit, MyItemToID.MyDocVersion, tranLookup)).MyLookup); if (tranLookup.ContainsKey(ToID)) myItemToID = tranLookup[ToID]; - //else - // Console.WriteLine("Transition May Not Be Correct at Location"); + else + _MyLog.WarnFormat("Invalid Unit Transition: from,to '{0}','{1}'", MyContent.ContentItems[0].ShortPath, myItemToID.ShortPath); } ItemInfo myItemRangeID = MyItemRangeID; if (tranLookup.ContainsKey(RangeID)) @@ -85,8 +85,9 @@ namespace VEPROMS.CSLA.Library tranLookup.AddProcLookup(MyItemRangeID.MyProcedure.ItemID, ProcedureInfo.GetNewLookup(tranLookup, new TransitionLookupEventArgs(MyItemRangeID.MyProcedure.ItemID, tranLookup.ApplicabilityUnit, MyItemRangeID.MyDocVersion, tranLookup)).MyLookup); if (tranLookup.ContainsKey(RangeID)) myItemRangeID = tranLookup[RangeID]; - //else - // Console.WriteLine("Transition May Not Be Correct at Location"); + else + if (myItemRangeID.ItemID != myItemToID.ItemID) + _MyLog.WarnFormat("Invalid Unit Range Transition: from,to '{0}','{1}'", MyContent.ContentItems[0].ShortPath, myItemRangeID.ShortPath); //Console.WriteLine("Format = {0}", item.ActiveFormat); //Console.WriteLine("item = {0}", item.ItemID); //Console.WriteLine("TranType = {0}", TranType);