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:
@@ -2253,5 +2253,30 @@ OnPropertyChanged("Default_BkColor");
|
||||
}
|
||||
//end added by jcb to fix master issue byron/braidwood
|
||||
#endregion
|
||||
#region Enhanced
|
||||
// C2019-045: For enhanced procedures, allow modifications of number & text.
|
||||
[Category("Enhanced Settings")]
|
||||
[Browsable(false)]
|
||||
[DisplayName("AllowMods")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
[Description("Allow Modifications of Number and Text")]
|
||||
public bool Enhanced_AllowMods
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["Enhanced", "allowmods"];
|
||||
if (s == string.Empty) return false; // empty is false
|
||||
return bool.Parse(s);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_SaveChangesToDocVersionConfig)
|
||||
{
|
||||
_Xp["Enhanced", "allowmods"] = value.ToString();
|
||||
OnPropertyChanged("Enhanced_AllowMods");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
@@ -629,14 +629,19 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp.LocalEntry != null && tmpInfo.MyEntry != null && tmp.MyEntry.MyDocument.DocID != tmpInfo.MyEntry.MyDocument.DocID)
|
||||
EntryInfo.Refresh(tmp.MyEntry);
|
||||
}
|
||||
// Update Enhanced Document Text
|
||||
StepConfig sc = new StepConfig(tmp.Config);
|
||||
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
|
||||
// Update Enhanced Document Text
|
||||
StepConfig sc = new StepConfig(tmp.Config);
|
||||
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
|
||||
{
|
||||
// Without this 'if' infinite loop. Only update text if in source and updating to point to enhanced.
|
||||
if (ed.Type != 0)
|
||||
{
|
||||
// Without this 'if' infinite loop. Only update text if in source and updating to point to enhanced.
|
||||
if (ed.Type != 0)
|
||||
ItemInfo ii = ItemInfo.Get(ed.ItemID);
|
||||
// C2019-045: For enhanced procedures, allow modification of number & text. A setting on the docversion (set from Properties dialog) defines whether text
|
||||
// can be modified if it is an enhanced item. If it can be modified, don't do the automatic update if the 'source' text is changed.
|
||||
bool doEnhancedMods = ii.EnhAllowMod();
|
||||
if (!doEnhancedMods)
|
||||
{
|
||||
ItemInfo ii = ItemInfo.Get(ed.ItemID);
|
||||
DisplayText dt = new DisplayText(ii, ii.MyContent.Text, false);
|
||||
string str = ItemInfo.Get(tmp.ContentItems[0].ItemID).DisplayTextKeepSpecialChars;
|
||||
dt.Save(str);
|
||||
@@ -650,6 +655,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected virtual void RefreshFields(Content tmp)
|
||||
{
|
||||
|
Reference in New Issue
Block a user