B2015-071: Fixed handling of sublevels in templates (for EXEBCK)

B2015-071: EXEBCK template had spaces in template text, fixed parsing of this
This commit is contained in:
Kathy Ruffing 2015-06-22 14:41:55 +00:00
parent 3c489b709e
commit 7bc11c7fb6
2 changed files with 29 additions and 10 deletions

View File

@ -367,8 +367,9 @@ namespace VEPROMS.CSLA.Library
int tpIndx = GetSmartTemplateIndex(topType, (int)MyContent.Type);
if (tpIndx != -1)
{
ItemInfo siblingSmart = null;
ItemInfo firstSmart = null;
ItemInfo siblingSmart = null; // keep track of sibling
ItemInfo firstSmart = null; // hls or top template step
ItemInfo parentSmart = null; // keep track of parent as creating children
int level = ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].level;
string tmptext = ActiveFormat.PlantFormat.FormatData.NewTemplateFormat ? text : ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
int prevlevel = level;
@ -377,32 +378,35 @@ namespace VEPROMS.CSLA.Library
if (firstSmart == null)
{
firstSmart = NewItemInfoFetch(ItemID, adPart, number, tmptext, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
siblingSmart = firstSmart;
siblingSmart = parentSmart = firstSmart;
newItemID = firstSmart.ItemID;
}
else
{
E_FromType fromType = E_FromType.Step;
EAddpingPart addPart = EAddpingPart.Child; // level > previous, add a child.
if (level == prevlevel) addPart = EAddpingPart.After;
if (level < prevlevel)
EAddpingPart addPart = EAddpingPart.Child; // level > previous, add a child.
if (level == prevlevel) addPart = EAddpingPart.After; // level = previous, add a sibling
if (level < prevlevel) // level < previous, go up to previous level's id
{
if (ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
{
fromType = E_FromType.RNO;
addPart = EAddpingPart.Child;
newItemID = firstSmart.ItemID;
}
else
{
addPart = EAddpingPart.After;
newItemID = parentSmart.ItemID;
}
newItemID = siblingSmart.ItemID;
}
tmptext = /*ActiveFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": */ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
tmptext = ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
newItemID = tmp.ItemID;
if (level < prevlevel) siblingSmart = tmp;
if (level < prevlevel) siblingSmart = parentSmart;
else if (level > prevlevel) parentSmart = siblingSmart;
if (level == prevlevel) siblingSmart = tmp;
}
tpIndx++;
prevlevel = level;

View File

@ -288,7 +288,22 @@ namespace VEPROMS.CSLA.Library
string[] tmpOld = tpl.Split(" ".ToCharArray());
level = Convert.ToInt32(tmpOld[0]);
type = Convert.ToInt32(tmpOld[1]);
stmp = tmpOld.Length <= 2 ? null : tmpOld[2];
if (tmpOld.Length <= 2)
stmp = null;
else if (tmpOld.Length > 3)
{
// Braidwood has spaces as part of the text in the 3rd field, i.e. (See Deviation Document)
// handle this special case
int indxx = tpl.IndexOf(" ");
if (indxx < 0) stmp = null;
else
{
indxx = tpl.IndexOf(" ", indxx+1);
stmp = (indxx > -1) ? tpl.Substring(indxx) : null;
}
}
else
stmp = tmpOld[2];
}
else
{