Fix some of enhanced format flags
C2016-008: Create an enhanced step if it is missing from a source
This commit is contained in:
@@ -863,7 +863,12 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp = InsertEnhancedSmartTemplateSubStep(text, number, this, addType, (int)type, fromType, newSourceID);
|
||||
}
|
||||
else
|
||||
tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, 20002, newSourceID);
|
||||
{
|
||||
// if 'type' is high level, use standard hls as type.
|
||||
// if 'type' is caution/note, use the base caution/note for 'type'
|
||||
int ltype = IsHigh ? 20002 : (IsNote ? 20007 : 20006);
|
||||
tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, ltype, newSourceID);
|
||||
}
|
||||
if (tmp == null) return null;
|
||||
|
||||
// if next exists, it is updated in SQL so we have to manually force the iteminfo updates
|
||||
@@ -1447,6 +1452,67 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
RefreshConfig();
|
||||
}
|
||||
public ItemInfo DoAddMissingEnhancedSteps(int enhtype)
|
||||
{
|
||||
// from this step, need to find an insertion point in the enhanced procedure/section. Look for a step that has enhanced
|
||||
// links in its config: first go through previous steps, then if none found in previous go through next, if none found
|
||||
// go to parent
|
||||
ItemInfo newEnh = null;
|
||||
// look through pervious first:
|
||||
ItemInfo iiCur = this.MyPrevious;
|
||||
EAddpingPart addtype = EAddpingPart.After;
|
||||
while (iiCur != null && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiCur.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == enhtype) // found one to use:
|
||||
{
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
iiCur = iiCur.MyPrevious;
|
||||
}
|
||||
|
||||
// no previous have enhanced links. now go through next:
|
||||
ItemInfo iiNxt = this.GetNextItem();
|
||||
addtype = EAddpingPart.Before;
|
||||
while (iiNxt != null && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiNxt.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == enhtype) // found one to use:
|
||||
{
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
iiNxt = iiNxt.GetNextItem();
|
||||
}
|
||||
|
||||
// no next either, try the parent.
|
||||
ItemInfo iiPar = this.MyParent;
|
||||
addtype = EAddpingPart.Child;
|
||||
while (iiPar != null && !iiPar.IsProcedure && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiPar.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == enhtype) // found one to use:
|
||||
{
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
iiPar = iiPar.MyParent;
|
||||
}
|
||||
if (newEnh != null)
|
||||
{
|
||||
StepConfig sc = new StepConfig(MyContent.Config);
|
||||
sc.AddEnhancedDocument(enhtype, newEnh.ItemID);
|
||||
SaveConfig(sc.ToString());
|
||||
}
|
||||
return newEnh;
|
||||
}
|
||||
#endregion
|
||||
#region DataPortal
|
||||
private void DataPortal_Fetch(PastingPartCriteria criteria)
|
||||
|
Reference in New Issue
Block a user