B2022-083: Support Conditional RO Values
This commit is contained in:
@@ -317,6 +317,7 @@ namespace VEPROMS.CSLA.Library
|
||||
AssociationConfig ac = new AssociationConfig(associationInfo);
|
||||
return ac.ROUpdate_LoadingFigures;
|
||||
}
|
||||
|
||||
#region SearchPaths
|
||||
public string _SearchDVPath;
|
||||
public string SearchDVPath
|
||||
@@ -330,6 +331,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public string SearchPath { get { return ""; } }
|
||||
#endregion
|
||||
|
||||
#region UnlinkEnhancedDocVersion
|
||||
// Unlink (clear) enhanced from source for this docversion. Refresh all related cache items.
|
||||
public void DoUnlinkEnhancedDocVersion()
|
||||
@@ -371,6 +373,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion UnlinkEnhanced
|
||||
|
||||
#region DocVersion Config
|
||||
[NonSerialized]
|
||||
private DocVersionConfig _DocVersionConfig;
|
||||
@@ -381,7 +384,9 @@ namespace VEPROMS.CSLA.Library
|
||||
_DocVersionConfig = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MOVE TO DOCVERSION CONFIG
|
||||
|
||||
private string GetProfile(string grp, string nam)
|
||||
{
|
||||
return GetProfile(grp, nam, false);
|
||||
@@ -409,20 +414,25 @@ namespace VEPROMS.CSLA.Library
|
||||
public string UnitSpecific(string str, int len, ItemInfo ii)
|
||||
{
|
||||
ProcedureInfo pi = ii as ProcedureInfo;
|
||||
|
||||
if (pi == null) // B2022-004: Don't crash if Proc PC/PC (ii is from a list, so wasn't an ItemInfo)
|
||||
{
|
||||
pi = ProcedureInfo.Get(ii.ItemID);
|
||||
}
|
||||
|
||||
if (pi == null) return "";
|
||||
|
||||
string unitdes = "ID";
|
||||
string prefix = null;
|
||||
string fromunitdes = null;
|
||||
str = ItemInfo.ConvertToDisplayText(pi.MyContent.Number);
|
||||
bool hastoken = false;
|
||||
|
||||
// Determine if there is a token in the procedure number data, default is ID
|
||||
if (str.ToUpper().Contains(@"<U"))
|
||||
{
|
||||
hastoken = true;
|
||||
|
||||
if (str.ToUpper().IndexOf(@"<U-") > -1)
|
||||
{
|
||||
try
|
||||
@@ -438,6 +448,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (unitdes == "NUMBER")
|
||||
fromunitdes = DocVersionConfig.Unit_Number;
|
||||
else if (unitdes == "ID")
|
||||
@@ -468,8 +479,7 @@ namespace VEPROMS.CSLA.Library
|
||||
string[] units = mstr.Split(",".ToCharArray());
|
||||
string[] fromdata = fromunitdes.Split(",".ToCharArray());
|
||||
|
||||
// SelectedSlave is > 0 if a unit has been selected, for example from print or approve. It represents that index into
|
||||
// the list of units.
|
||||
// SelectedSlave is > 0 if a unit has been selected, for example from print or approve. It represents that index into the list of units.
|
||||
if (DocVersionConfig.SelectedSlave > 0)
|
||||
{
|
||||
prefix = units[0].Replace("#", "");
|
||||
@@ -482,12 +492,13 @@ namespace VEPROMS.CSLA.Library
|
||||
// 1) [] (square brackets) are placed around any prefixes determined from the <U> token or the Procedure Number data on
|
||||
// the working draft properties. If None, i.e. no units, are applicable, as selected from the Step Properties/Applicability tab.
|
||||
// there will be no text between the brackets to represent no applicability
|
||||
// 2) , (commas) are used as a delimeter. Only have 1 comma separating the prefix, there may be no text if some units are
|
||||
// 2) , (commas) are used as a delimiter. Only have 1 comma separating the prefix, there may be no text if some units are
|
||||
// not applicable, but code exists here so that ',,,' does not appear in the treenode
|
||||
// 3) don't duplicate resolved text, for example if NUMBER is used, and prefix text would be '[A,A,B,C,C]', only show '[A,B,C]'
|
||||
|
||||
bool sometext = false; // flag to use since don't want ',,,,,' before number
|
||||
List<string> prefs = new List<string>();
|
||||
|
||||
for (int i = 1; i <= UnitNames.Length; i++)
|
||||
{
|
||||
bool procAppl = pi.ApplInclude(i);
|
||||
@@ -502,10 +513,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
if (procAppl && tokRepAndPrefix != "") prefix = prefix + (prefix == null ? tokRepAndPrefix : (prefix != null && prefix.Length > 0 && prefix[prefix.Length - 1] != ',' ? "," : "") + tokRepAndPrefix);
|
||||
}
|
||||
|
||||
str = Regex.Replace(str, @"\<[uU]-[a-zA-Z]+\>", "");
|
||||
str = Regex.Replace(str, @"\<[uU]\>", "");
|
||||
|
||||
return (!sometext) ? str: "[" + prefix + "]" + str;
|
||||
}
|
||||
|
||||
public string UnitSpecific(string str, int len)
|
||||
{
|
||||
|
||||
@@ -536,11 +550,6 @@ namespace VEPROMS.CSLA.Library
|
||||
retvalu = str;
|
||||
else if (pnum[0] == '!')
|
||||
{
|
||||
// look for mstr in SET.INI
|
||||
// GetPrivateProfileString("replace", mstr, mstr, tonum, 24, "set.ini");
|
||||
|
||||
// TODO: NOT SURE IF SET.INI AND PROC.INI HAVE UNIQUE GROUP NAMES!!!!!!!
|
||||
//mstr = GetProfile("Replace", mstr);
|
||||
mstr = GetProfile("Replace", mstr, true); // true allow it to return a null if not found
|
||||
if (mstr == null) retvalu = str; // no replacement, use procedure number as is
|
||||
}
|
||||
@@ -580,20 +589,19 @@ namespace VEPROMS.CSLA.Library
|
||||
public string Evaluate(string str, int len)
|
||||
{
|
||||
string retval = null;
|
||||
string swhir = "PSU"; /* order inwhich to check */
|
||||
string swhir = "PSU"; /* order in which to check */
|
||||
string pn;
|
||||
|
||||
if (str.Length > 1 && str[1] == '-')
|
||||
{
|
||||
int swptr = swhir.IndexOf((str.ToUpper())[0]);
|
||||
//char swchar = '';
|
||||
//if (swptr != -1)
|
||||
// swchar = swhir[swptr];
|
||||
|
||||
string sav = str.Substring(len);
|
||||
str = str.Substring(0, len);
|
||||
string substr = str.Substring(2);
|
||||
substr = substr.Replace(" ", "");
|
||||
while (swptr >= 0 && swptr < swhir.Length && retval == null) //retval.Equals(string.Empty))
|
||||
|
||||
while (swptr >= 0 && swptr < swhir.Length && retval == null)
|
||||
{
|
||||
switch (swhir[swptr])
|
||||
{
|
||||
@@ -607,10 +615,6 @@ namespace VEPROMS.CSLA.Library
|
||||
retval = this.DocVersionConfig.Unit_Number;
|
||||
if (substr.ToLower() == "text")
|
||||
retval = this.DocVersionConfig.Unit_Text;
|
||||
//retval = this.DocVersionConfig.Other_Unit_ID;
|
||||
//retval = this.DocVersionConfig.Other_Unit_Name;
|
||||
//retval = this.DocVersionConfig.Other_Unit_Number;
|
||||
//retval = this.DocVersionConfig.Other_Unit_Text;
|
||||
break;
|
||||
case 'S':
|
||||
//retval = GetProfile("Procedure_Set", substr, true);
|
||||
@@ -639,60 +643,54 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
retval = this.DocVersionConfig.Unit_ID;
|
||||
}
|
||||
// if the return value is empty, then the resulting
|
||||
// evaluation should repeat the token string including
|
||||
// the braces. - the beginning brace is not passed in.
|
||||
//if (retval.Equals(string.Empty))
|
||||
//{
|
||||
// retval = (char*)mallocq(len + 3);
|
||||
// strncpy(retval, str - 1, len + 2);
|
||||
//}
|
||||
|
||||
if (retval == null)
|
||||
retval = string.Format("<{0}>", str.Substring(0, len));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
public string ProcessDocVersionSpecificInfo(string rawvalue)
|
||||
{
|
||||
string str = rawvalue;
|
||||
string rtnstr = "";
|
||||
string rtnstr = string.Empty;
|
||||
int l = rawvalue.Length;
|
||||
|
||||
while (l > 0)
|
||||
{
|
||||
int ptr = str.IndexOf('<'); //nextDelimiter("<", str, l);
|
||||
int cptr = (ptr == -1) ? -1 : str.IndexOf('>'); //nextDelimiter(">", ptr, strlen(ptr));
|
||||
int ptr = str.IndexOf('<');
|
||||
int cptr = (ptr == -1) ? -1 : str.IndexOf('>');
|
||||
|
||||
// jsj 2/5/10 added "|| (ptr > cptr)" to fix bug where rawvalue = "Insert token for ->Step<- to transition back to."
|
||||
if (ptr == -1 || (ptr > -1 && ((cptr == -1) || (ptr > cptr))))
|
||||
{
|
||||
//add(new seText(str, l));
|
||||
//str += l;
|
||||
rtnstr += str;
|
||||
l = 0; // jump out of while loop
|
||||
}
|
||||
else
|
||||
{
|
||||
int cnt = ptr;
|
||||
|
||||
if (cnt > 0)
|
||||
{
|
||||
//add(new seText(str, cnt));
|
||||
rtnstr += str.Substring(0, cnt);
|
||||
l -= cnt;
|
||||
str = str.Substring(ptr);
|
||||
}
|
||||
ptr = str.IndexOf('>') + 1; //nextDelimiter(">", str, l) + 1;
|
||||
cnt = ptr; //(int)(ptr - str);
|
||||
//add(new seUser(str + 1, cnt - 2));
|
||||
|
||||
ptr = str.IndexOf('>') + 1;
|
||||
cnt = ptr;
|
||||
|
||||
rtnstr += Evaluate(str.Substring(1, cnt - 2), cnt - 2);
|
||||
l -= cnt;
|
||||
str = str.Substring(ptr); //ptr;
|
||||
|
||||
str = str.Substring(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
return rtnstr;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
ItemInfoList _Procedures = null;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1232,6 +1232,10 @@ namespace VEPROMS.CSLA.Library
|
||||
return (MyPrevious == null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public bool IsAutoTOCSection
|
||||
{
|
||||
get
|
||||
@@ -2615,6 +2619,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefreshFields(enhii); // B2021-042: Crash on link/unlink/link - refresh cache
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2672,6 +2677,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return dtext;
|
||||
}
|
||||
}
|
||||
|
||||
internal int _SearchAnnotationID;
|
||||
public int SearchAnnotationID
|
||||
{
|
||||
|
@@ -6,6 +6,7 @@ using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using Csla.Validation;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@@ -117,12 +118,15 @@ namespace VEPROMS.CSLA.Library
|
||||
public static PdfInfo Get(ItemInfo sect, bool ovrride)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
while (count < 2)
|
||||
{
|
||||
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
|
||||
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig;
|
||||
PdfInfo myPdf = null;
|
||||
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
|
||||
if (sc != null && sc.Section_WordMargin == "Y")
|
||||
{
|
||||
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
|
||||
@@ -132,15 +136,19 @@ namespace VEPROMS.CSLA.Library
|
||||
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
|
||||
}
|
||||
// ovrride forces the the printing of the word seciton, which creates a word file with resolved ROs, which is saved for an approved export
|
||||
if (!ovrride || (ovrride && count ==1))
|
||||
|
||||
// override forces the printing of the word section, which creates a word file with resolved ROs, which is saved for an approved export
|
||||
if (!ovrride || (ovrride && count == 1))
|
||||
{
|
||||
if (myPdf != null) return myPdf;
|
||||
if (count > 0) return null; // Could not find or create a pdf
|
||||
}
|
||||
|
||||
MSWordToPDF.SetDocPdf(sect.MyContent.MyEntry.MyDocument, sect);
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user