diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 54c45d78..8ff51201 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -14,6 +14,12 @@ namespace VEPROMS.CSLA.Library { private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); #region Properties + private bool _setDTS = true; // Added for when data is cleaned so that DTS/UserID are not reset (for B2016-037 fix) + public bool SetDTS + { + get { return _setDTS; } + set { _setDTS = value; } + } private E_FieldToEdit _FieldToEdit; public E_FieldToEdit FieldToEdit { @@ -62,8 +68,11 @@ namespace VEPROMS.CSLA.Library case E_FieldToEdit.StepText: case E_FieldToEdit.Text: _MyItem.MyContent.Text = value; - _MyItem.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.MyContent.DTS = DateTime.Now; + if (SetDTS) + { + _MyItem.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; + _MyItem.MyContent.DTS = DateTime.Now; + } break; case E_FieldToEdit.Number: _MyItem.MyContent.Number = value; @@ -183,6 +192,11 @@ namespace VEPROMS.CSLA.Library StartText = text; ProfileTimer.Pop(profileDepth); } + + public void CleanUpNewIDs() + { + Save(InfoText); + } private static ItemInfo _MyStaticItemInfo = null; // Used to report errors private string ReplaceLinesWithUnicode(string text) { @@ -979,7 +993,9 @@ namespace VEPROMS.CSLA.Library displayLinkElement l_dte = (displayLinkElement)dte; if (odte.Link == l_dte.Link) { - found = true; + // (B2016-037): The following line was added so that if a 'NewID' is found in the data it gets resolved + // even if the links in original vs modified text are same (they both have 'NewID', i.e. an incompletely inserted transition - bad data) + if (!odte.Link.Contains("")) found = true; break; } } @@ -1000,7 +1016,7 @@ namespace VEPROMS.CSLA.Library } l_dte.Link = l_dte.Link.Replace("", string.Format("", rousg.ROUsageID)); l_dte.TextAndLink = l_dte.TextAndLink.Replace("", string.Format("", rousg.ROUsageID)); - break; + //break; // this break was causing only the first new ro's 'NewID' to get resolved. (found during fix of B2016-037) } else if (dte.Type == E_TextElementType.TransitionRange || dte.Type == E_TextElementType.Transition) { diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index d4608075..bffb55a6 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -2722,6 +2722,16 @@ namespace Volian.Controls.Library TabFont = itemInfo.MyTab.MyFont.WindowsFont; break; case 2: // Steps + // Fix for B2016-037: there were ''s in saved content text. This was caused by a bug in code that + // did not resolve these correctly if there was more than 1 in the text. So if, when loading the text, this + // is found, resolve them: + if (itemInfo.MyContent.Text.Contains("")) + { + DisplayText vlntxt = new DisplayText(itemInfo, E_EditPrintMode.Edit, E_ViewMode.Edit, false, E_FieldToEdit.StepText, true, null, null, false); + vlntxt.SetDTS = false; + vlntxt.CleanUpNewIDs(); + vlntxt = null; + } ContentFont = myStepPanel.StepFont;//lblTab.Font = myStepPanel.StepFont; if (itemInfo.MyTab != null ) TabFont = itemInfo.MyTab.MyFont.WindowsFont; MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[ContentType % 10000];