B2018-118: Enhanced tabs are incorrect when mix of (linked & unlinked) Cautions/Notes

This commit is contained in:
Kathy Ruffing 2018-08-28 15:10:55 +00:00
parent 06e24894a3
commit a2c3844ffd

View File

@ -3750,9 +3750,34 @@ namespace VEPROMS.CSLA.Library
EnhancedDocuments eds = GetMyEnhancedDocuments(); EnhancedDocuments eds = GetMyEnhancedDocuments();
if (eds != null && eds.Count == 1 && eds[0].Type == 0) if (eds != null && eds.Count == 1 && eds[0].Type == 0)
{ {
// B2018-114 check for a null before getting the Ordinal value (code that uses this handles a Null return value from this Get
ItemInfo srcItem = ItemInfo.Get(eds[0].ItemID); ItemInfo srcItem = ItemInfo.Get(eds[0].ItemID);
if (srcItem != null) // B2018-114 check for a null before getting the Ordinal value (code that uses this handles a Null return value from this Get if (srcItem == null) return null;
return srcItem.Ordinal; if (srcItem.IsHigh) return srcItem.Ordinal;
// B2018-118: the LinkedOrdinal count must take into account cautions versus notes types:
ItemInfo hls = srcItem.MyHLS;
bool enIsCaution = this.IsCaution;
// get the first sibling and go through list for each type - go through notes first then cautions checking for each type:
// go through cautions first because these are the first parts:
int? ord = 0;
if (hls.Cautions != null && hls.Cautions.Count > 0)
{
foreach (ItemInfo caut in hls.Cautions)
{
if (caut.IsCaution && enIsCaution) ord++;
if (caut.IsNote && !enIsCaution) ord++;
if (caut.ItemID == srcItem.ItemID) return ord;
}
}
if (hls.Notes != null && hls.Notes.Count > 0)
{
foreach (ItemInfo note in hls.Notes)
{
if (note.IsCaution && enIsCaution) ord++;
if (note.IsNote && !enIsCaution) ord++;
if (note.ItemID == srcItem.ItemID) return ord;
}
}
} }
return null; return null;
} }