C2019-045: Fix length of procedure number for CCR to work
C2019-045: For enhanced procedures, allow modification of number & title
This commit is contained in:
@@ -363,6 +363,16 @@ namespace VEPROMS.CSLA.Library
|
||||
return _EnhType;
|
||||
}
|
||||
}
|
||||
public bool EnhAllowMod()
|
||||
{
|
||||
// C2019-045: For enhanced procedures, allow modifications of number & text. This method checks whether the
|
||||
// user selected to allow for modifications, i.e. the value in the docversion config, 'Enhanced_AllowMods' is true.
|
||||
// Note that the flag is set on the enhanced doc versions, not the source, so that each enhanced can have its own setting.
|
||||
if (!IsProcedure) return false;
|
||||
|
||||
if (MyDocVersion.DocVersionConfig.Enhanced_AllowMods) return true;
|
||||
return false;
|
||||
}
|
||||
public bool InList(params int[] IDs)
|
||||
{
|
||||
foreach (int id in IDs)
|
||||
@@ -7148,14 +7158,18 @@ namespace VEPROMS.CSLA.Library
|
||||
// the text in the enhanced item based on the displaytext of the source item.
|
||||
foreach (ItemInfo ii in iil)
|
||||
{
|
||||
EnhancedDocuments seds = ii.GetMyEnhancedDocuments();
|
||||
if (seds != null && seds.Count != 0)
|
||||
// C2019-045: if allowing mods for procedure num/text we don't want to update the enhanced text so only do if not allowing mods:
|
||||
if (!ii.EnhAllowMod())
|
||||
{
|
||||
ItemInfo srcItem = ItemInfo.Get(seds[0].ItemID);
|
||||
using (Item enhItem = Item.Get(ii.ItemID))
|
||||
EnhancedDocuments seds = ii.GetMyEnhancedDocuments();
|
||||
if (seds != null && seds.Count != 0)
|
||||
{
|
||||
enhItem.MyContent.Text = srcItem.DisplayTextKeepSpecialChars;
|
||||
enhItem.Save();
|
||||
ItemInfo srcItem = ItemInfo.Get(seds[0].ItemID);
|
||||
using (Item enhItem = Item.Get(ii.ItemID))
|
||||
{
|
||||
enhItem.MyContent.Text = srcItem.DisplayTextKeepSpecialChars;
|
||||
enhItem.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1615,6 +1615,18 @@ namespace VEPROMS.CSLA.Library
|
||||
// look through pervious first:
|
||||
ItemInfo iiCur = this.MyPrevious;
|
||||
EAddpingPart addtype = EAddpingPart.After;
|
||||
|
||||
// C2019-045: For enhanced procedures, allow modifications of number & text. When a procedure is inserted, if allowing updates, the number/text doesn't
|
||||
// get set to the existing source because this was done automatically in the contentinfo code that sets the enhanced text to the source and this code
|
||||
// isn't run if modifications are allowed. Thus, use the number/text here for this case. If the changes in this method aren't made the number is emtpy
|
||||
// and the procedure text (title) is 'New Procedure'
|
||||
string pnum = null;
|
||||
string ptext = null;
|
||||
if (IsProcedure)
|
||||
{
|
||||
pnum = MyContent.Number;
|
||||
ptext = MyContent.Text;
|
||||
}
|
||||
while (iiCur != null && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiCur.GetMyEnhancedDocuments())
|
||||
@@ -1626,15 +1638,20 @@ namespace VEPROMS.CSLA.Library
|
||||
// B2017-272 did not need the if-check to set the enhanced type (commented it out)
|
||||
//if (iiCur.MyContent.Type == MyContent.Type) // B2017-134 the enhanced section was being created with the wrong document type creating new enhanced section from EOP (bryon data)
|
||||
enhType = (int)exEnh.MyContent.Type;
|
||||
if (exEnh.IsStep)
|
||||
{
|
||||
// B2018-115: use the correct step type for the add.
|
||||
// if coming from a HLS, note or caution, the enhanced type should be the base hls/note/caution type (from GetEnhancedTypeForAdd)
|
||||
enhType = GetEnhancedTypeForAdd();
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, enhType, edSource.Type, this.ItemID);
|
||||
}
|
||||
else
|
||||
newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, enhType, edSource.Type, this.ItemID);
|
||||
if (exEnh.IsStep)
|
||||
{
|
||||
// B2018-115: use the correct step type for the add.
|
||||
// if coming from a HLS, note or caution, the enhanced type should be the base hls/note/caution type (from GetEnhancedTypeForAdd)
|
||||
enhType = GetEnhancedTypeForAdd();
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, enhType, edSource.Type, this.ItemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsProcedure || !exEnh.MyDocVersion.DocVersionConfig.Enhanced_AllowMods)
|
||||
newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, enhType, edSource.Type, this.ItemID);
|
||||
else
|
||||
newEnh = exEnh.InsertEnhancedItems(ptext, pnum, addtype, enhType, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
iiCur = iiCur.MyPrevious;
|
||||
@@ -1662,7 +1679,12 @@ namespace VEPROMS.CSLA.Library
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, enhType, edSource.Type, this.ItemID);
|
||||
}
|
||||
else
|
||||
newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, enhType, edSource.Type, this.ItemID);
|
||||
{
|
||||
if (!IsProcedure || !exEnh.MyDocVersion.DocVersionConfig.Enhanced_AllowMods)
|
||||
newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, enhType, edSource.Type, this.ItemID);
|
||||
else
|
||||
newEnh = exEnh.InsertEnhancedItems(ptext, pnum, addtype, enhType, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
iiNxt = iiNxt.GetNextItem();
|
||||
@@ -1683,7 +1705,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// get the enhaced docversioninfo:
|
||||
DocVersionInfo enhDVInfo = DocVersionInfo.Get(ded.VersionID);
|
||||
using (Procedure newenhProcedure = Procedure.MakeProcedure(enhDVInfo, enhDVInfo.Procedures.Count != 0 ? enhDVInfo.Procedures[enhDVInfo.Procedures.Count - 1] :null, MyContent.Number, "New Procedure", 0))
|
||||
string epnum = MyContent.Number;
|
||||
string eptext = "New Procedure";
|
||||
if (enhDVInfo.DocVersionConfig.Enhanced_AllowMods)
|
||||
eptext = MyContent.Text;
|
||||
using (Procedure newenhProcedure = Procedure.MakeProcedure(enhDVInfo, enhDVInfo.Procedures.Count != 0 ? enhDVInfo.Procedures[enhDVInfo.Procedures.Count - 1] :null, MyContent.Number, eptext, 0))
|
||||
{
|
||||
newEnh = ItemInfo.Get(newenhProcedure.ItemID);
|
||||
string scng = null;
|
||||
|
Reference in New Issue
Block a user