B2016-037: Cut text with referenced objects removes text (actually ‘cleans’ any content text that has ‘<NewID>’ in it
This commit is contained in:
parent
4dfddeecb4
commit
d874371f44
@ -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;
|
||||
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("<NewID>")) found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1000,7 +1016,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
l_dte.Link = l_dte.Link.Replace("<NewID>", string.Format("<CROUSGID={0}>", rousg.ROUsageID));
|
||||
l_dte.TextAndLink = l_dte.TextAndLink.Replace("<NewID>", string.Format("<CROUSGID={0}>", 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)
|
||||
{
|
||||
|
@ -2722,6 +2722,16 @@ namespace Volian.Controls.Library
|
||||
TabFont = itemInfo.MyTab.MyFont.WindowsFont;
|
||||
break;
|
||||
case 2: // Steps
|
||||
// Fix for B2016-037: there were '<NewID>'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("<NewID>"))
|
||||
{
|
||||
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user