diff --git a/source/Plugins/AyaNova.Plugin.V8/util.cs b/source/Plugins/AyaNova.Plugin.V8/util.cs index 38c4129..0b2814d 100644 --- a/source/Plugins/AyaNova.Plugin.V8/util.cs +++ b/source/Plugins/AyaNova.Plugin.V8/util.cs @@ -333,7 +333,7 @@ namespace AyaNova.PlugIn.V8 return inObj; } - + //clean up tags from client submission //remove dupes, substitute dashes for spaces, lowercase and shorten if exceed 255 chars //and sorts before returning to ensure consistent ordering @@ -505,153 +505,153 @@ namespace AyaNova.PlugIn.V8 //***IMPORTANT: Also need to add translations for any new biz objects added that don't match exactly the name here in the key //because enumlist gets it that way, i.e. "Global" would be the expected key - - NoType = 0, - Global = 1, - //corebizobject - Widget = 2, - //corebizobject - User = 3, - ServerState = 4, - License = 5, - LogFile = 6, - PickListTemplate = 7, - //corebizobject - Customer = 8, - ServerJob = 9, - //corebizobject - Contract = 10, - TrialSeeder = 11, - ServerMetrics = 12, - Translation = 13, - UserOptions = 14, - //corebizobject - HeadOffice = 15, - //corebizobject - LoanUnit = 16, - FileAttachment = 17, - DataListSavedFilter = 18, - FormCustom = 19, - //corebizobject - Part = 20, - //corebizobject - PM = 21, - //corebizobject - PMItem = 22, - //corebizobject - QuoteItemExpense = 23, - //corebizobject - QuoteItemLabor = 24, - //corebizobject - Project = 25, - //corebizobject - PurchaseOrder = 26, - //corebizobject - Quote = 27, - //corebizobject - QuoteItem = 28, - //corebizobject - QuoteItemLoan = 29, - //corebizobject - QuoteItemPart = 30, - //corebizobject - Unit = 31, - //corebizobject - UnitModel = 32, - //corebizobject - Vendor = 33, - //--- WorkOrder - //corebizobject - WorkOrder = 34, - //corebizobject - WorkOrderItem = 35, - //corebizobject - WorkOrderItemExpense = 36, - //corebizobject - WorkOrderItemLabor = 37, - //corebizobject - WorkOrderItemLoan = 38, - //corebizobject - WorkOrderItemPart = 39, - //corebizobject - WorkOrderItemPartRequest = 40, - //corebizobject - WorkOrderItemScheduledUser = 41, - //corebizobject - WorkOrderItemTask = 42, - //corebizobject - WorkOrderItemTravel = 43, - //corebizobject - WorkOrderItemUnit = 44, - //--- - //corebizobject - QuoteItemScheduledUser = 45, - //corebizobject - QuoteItemTask = 46, - GlobalOps = 47,//really only used for rights, not an object type of any kind - BizMetrics = 48,//deprecate? Not used for anything as of nov 2020 - Backup = 49, - Notification = 50, - NotifySubscription = 51, - //corebizobject - Reminder = 52, - UnitMeterReading = 53, - //corebizobject - CustomerServiceRequest = 54, - // ServiceBank = 55, - OpsNotificationSettings = 56, - Report = 57, - DashboardView = 58, - //corebizobject - CustomerNote = 59, - //corebizobject - Memo = 60, - //corebizobject - Review = 61, - //corebizobject - ServiceRate = 62, - //corebizobject - TravelRate = 63, - //corebizobject - TaxCode = 64, - //corebizobject - PartAssembly = 65, - //corebizobject - PartWarehouse = 66, - PartInventory = 67, - DataListColumnView = 68, - PartInventoryRestock = 69,//for list only, synthetic object - PartInventoryRequest = 70,//for list only not, synthetic object - WorkOrderStatus = 71, - TaskGroup = 72, - WorkOrderItemOutsideService = 73, - WorkOrderItemPriority = 74, - WorkOrderItemStatus = 75, - //corebizobject - QuoteItemTravel = 76, - //corebizobject - QuoteItemUnit = 77, - QuoteStatus = 78, - QuoteItemOutsideService = 79, - //corebizobject - PMItemExpense = 80, - //corebizobject - PMItemLabor = 81, - //corebizobject - PMItemLoan = 82, - //corebizobject - PMItemPart = 83, - //corebizobject - PMItemPartRequest = 84, - //corebizobject - PMItemScheduledUser = 85, - //corebizobject - PMItemTask = 86, - //corebizobject - PMItemTravel = 87, - //corebizobject - PMItemUnit = 88, - PMItemOutsideService = 89 + + NoType = 0, + Global = 1, + //corebizobject + Widget = 2, + //corebizobject + User = 3, + ServerState = 4, + License = 5, + LogFile = 6, + PickListTemplate = 7, + //corebizobject + Customer = 8, + ServerJob = 9, + //corebizobject + Contract = 10, + TrialSeeder = 11, + ServerMetrics = 12, + Translation = 13, + UserOptions = 14, + //corebizobject + HeadOffice = 15, + //corebizobject + LoanUnit = 16, + FileAttachment = 17, + DataListSavedFilter = 18, + FormCustom = 19, + //corebizobject + Part = 20, + //corebizobject + PM = 21, + //corebizobject + PMItem = 22, + //corebizobject + QuoteItemExpense = 23, + //corebizobject + QuoteItemLabor = 24, + //corebizobject + Project = 25, + //corebizobject + PurchaseOrder = 26, + //corebizobject + Quote = 27, + //corebizobject + QuoteItem = 28, + //corebizobject + QuoteItemLoan = 29, + //corebizobject + QuoteItemPart = 30, + //corebizobject + Unit = 31, + //corebizobject + UnitModel = 32, + //corebizobject + Vendor = 33, + //--- WorkOrder + //corebizobject + WorkOrder = 34, + //corebizobject + WorkOrderItem = 35, + //corebizobject + WorkOrderItemExpense = 36, + //corebizobject + WorkOrderItemLabor = 37, + //corebizobject + WorkOrderItemLoan = 38, + //corebizobject + WorkOrderItemPart = 39, + //corebizobject + WorkOrderItemPartRequest = 40, + //corebizobject + WorkOrderItemScheduledUser = 41, + //corebizobject + WorkOrderItemTask = 42, + //corebizobject + WorkOrderItemTravel = 43, + //corebizobject + WorkOrderItemUnit = 44, + //--- + //corebizobject + QuoteItemScheduledUser = 45, + //corebizobject + QuoteItemTask = 46, + GlobalOps = 47,//really only used for rights, not an object type of any kind + BizMetrics = 48,//deprecate? Not used for anything as of nov 2020 + Backup = 49, + Notification = 50, + NotifySubscription = 51, + //corebizobject + Reminder = 52, + UnitMeterReading = 53, + //corebizobject + CustomerServiceRequest = 54, + // ServiceBank = 55, + OpsNotificationSettings = 56, + Report = 57, + DashboardView = 58, + //corebizobject + CustomerNote = 59, + //corebizobject + Memo = 60, + //corebizobject + Review = 61, + //corebizobject + ServiceRate = 62, + //corebizobject + TravelRate = 63, + //corebizobject + TaxCode = 64, + //corebizobject + PartAssembly = 65, + //corebizobject + PartWarehouse = 66, + PartInventory = 67, + DataListColumnView = 68, + PartInventoryRestock = 69,//for list only, synthetic object + PartInventoryRequest = 70,//for list only not, synthetic object + WorkOrderStatus = 71, + TaskGroup = 72, + WorkOrderItemOutsideService = 73, + WorkOrderItemPriority = 74, + WorkOrderItemStatus = 75, + //corebizobject + QuoteItemTravel = 76, + //corebizobject + QuoteItemUnit = 77, + QuoteStatus = 78, + QuoteItemOutsideService = 79, + //corebizobject + PMItemExpense = 80, + //corebizobject + PMItemLabor = 81, + //corebizobject + PMItemLoan = 82, + //corebizobject + PMItemPart = 83, + //corebizobject + PMItemPartRequest = 84, + //corebizobject + PMItemScheduledUser = 85, + //corebizobject + PMItemTask = 86, + //corebizobject + PMItemTravel = 87, + //corebizobject + PMItemUnit = 88, + PMItemOutsideService = 89 @@ -746,6 +746,94 @@ Locale Français is customized [signature: 804154061] exporting + public static string v7StrokePathTov8SVG(string spath, int width, int height) + { + + List> lPoints = new List>(); + + string[] sLines = spath.Split('X'); + + foreach (string sLine in sLines) + { + string[] sPoints = sLine.Trim().Split(' '); + + if (sPoints.Length > 0) + { + foreach (string s in sPoints) + { + lPoints.Add(StringToPoint(s)); + } + } + } + + //"71.5,77.19999694824219 71.5,79.19999694824219 71.5,83.19999694824219 71.5,91.19999694824219 74.5,101.19999694824219 75.5,103.19999694824219 80.5,104.19999694824219 86.5,104.19999694824219 96.5,101.19999694824219 116.5,91.19999694824219 145.5,75.19999694824219 167.5,61.19999694824219 183.5,50.19999694824219 194.5,42.19999694824219 197.5,42.19999694824219 199.5,51.19999694824219 202.5,66.19999694824219 210.5,87.19999694824219 219.5,94.19999694824219 235.5,97.19999694824219 260.5,89.19999694824219 298.5,74.19999694824219 326.5,62.19999694824219 339.5,56.19999694824219 343.5,58.19999694824219 345.5,62.19999694824219 349.5,74.19999694824219 357.5,87.19999694824219 368.5,97.19999694824219 387.5,99.19999694824219 423.5,89.19999694824219 465.5,71.19999694824219 498.5,55.19999694824219 511.5,48.19999694824219 514.5,52.19999694824219 514.5,57.19999694824219 515.5,65.19999694824219 515.5,67.19999694824219 518.5,67.19999694824219 521.5,67.19999694824219 521.5,67.19999694824219" + //handmade equivalent + // + + //Now turn lPoints into svg and return + // + // + // + //https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + //NOTE: v7 sigpad is 300 by 100 pixels, however the points drawn are way larger than that so going with v8 size + //If this proves to be an issue could perhaps look for the largest coordinates then use that as the size, though I think + + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + //open + // sb.Append(""); + sb.Append($""); + //draw + sb.Append($""); + + //close + sb.Append(""); + return sb.ToString(); + } + + + private static Tuple StringToPoint(string s) + { + + if (string.IsNullOrWhiteSpace(s)) + return new Tuple(0, 0); + + if (!s.Contains(',')) + return new Tuple(0, 0); + + string[] spoint = s.Split(','); + + //case 1939 - can't treat the input in the parse as integers as they can apparently contain decimals now + //I suspect that the conversion with decimal is likely slower than checking to see if it has a decimal first so + //I'm breaking this out into two separate streams for performance + if (s.Contains('.')) + { + // if it contains a decimal then convert differently + return new Tuple( + Convert.ToInt32(Math.Round(Convert.ToDouble(spoint[0]))), + Convert.ToInt32(Math.Round(Convert.ToDouble(spoint[1]))) + ); + } + else + { + //if it doesn't contain a decimal then use the original method + //case 1978 wrap this in a try catch block due to one customer having NaN values + //in their signature stroke path string. + try + { + return new Tuple(int.Parse(spoint[0]), int.Parse(spoint[1])); + } + catch (System.FormatException) + { + return new Tuple(0, 0); + } + } + } + #endregion }//eoc