From 54c896346bc408beaf88fff994ba410030e3a074 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 4 May 2020 22:06:26 +0000 Subject: [PATCH] --- .../Properties/AssemblyInfo.cs | 2 +- source/Plugins/AyaNova.Plugin.V8/V8.cs | 75 ++++++++++++++----- 2 files changed, 56 insertions(+), 21 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/Properties/AssemblyInfo.cs b/source/Plugins/AyaNova.Plugin.V8/Properties/AssemblyInfo.cs index 7657899..8852e33 100644 --- a/source/Plugins/AyaNova.Plugin.V8/Properties/AssemblyInfo.cs +++ b/source/Plugins/AyaNova.Plugin.V8/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("7.6.0.0")] -[assembly: AssemblyFileVersion("7.6.3.0")] +[assembly: AssemblyFileVersion("7.6.0.0")] diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 68e8cbd..cd4a05f 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8 public string PluginVersion { - get { return "7.6 (patch 3)"; } + get { return "7.6"; } } public string About @@ -50,7 +50,7 @@ namespace AyaNova.PlugIn.V8 public Guid PluginID { - get { return new Guid("{73D7B77F-C96A-4198-9449-6529AFB6AA5B}"); } + get { return new Guid("{BD608E8A-820C-46D1-9D81-4CCB6E71B213}"); } } public System.Drawing.Image PluginSmallIcon @@ -132,13 +132,13 @@ namespace AyaNova.PlugIn.V8 return; } -#if(!DEBUG) + //#if(!DEBUG) if (!AyaBizUtils.AyaNovaConnectionSetting.SingleUserConnection) { MessageBox.Show("** WARNING: before proceeding ensure no other users are logged into AyaNova to ensure the integrity of your exported data. Failing to do so *will* result in damaged data. ***"); MessageBox.Show("** WARNING: before proceeding make sure your AyaNova Generator service is STOPPED to ensure the integrity of your exported data. Failing to do so *will* result in damaged data. ***"); } -#endif + //#endif Auth d = new Auth(); var res = d.ShowDialog(); ; @@ -215,7 +215,6 @@ namespace AyaNova.PlugIn.V8 FINISH DOWN TO HERE AND THEN CAN TEST WITH JOYCE AND BIG DB - todo: RAVEN workorder structure and then export here todo: modify each biz object export to include progress resetting code added to top of workorder service export reset op, subop at start of export so error doesn't show last previous item's name @@ -300,8 +299,8 @@ namespace AyaNova.PlugIn.V8 } catch (Exception ex) { - progress.Append("ERROR, During operation: " + progress.LastOp + "\n" + progress.LastSubOp); - progress.Append("\n************\nExport failed with error:"); + progress.Append("ERROR, During operation: \n" + progress.LastOp + "\n" + progress.LastSubOp); + progress.Append("\n************\nExport failed with error:\n"); progress.Append(ex.Message); progress.Append("stack:\n" + ex.StackTrace); } @@ -348,6 +347,8 @@ namespace AyaNova.PlugIn.V8 private async System.Threading.Tasks.Task ExportUsers(ProgressForm progress) { if (!progress.KeepGoing) return; + progress.Op("Start User export"); + progress.SubOp(""); ResetUniqueNames(); //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too @@ -531,6 +532,8 @@ namespace AyaNova.PlugIn.V8 private async System.Threading.Tasks.Task ExportClients(ProgressForm progress) { if (!progress.KeepGoing) return; + progress.Op("Start Client export"); + progress.SubOp(""); ResetUniqueNames(); var ObjectTypeName = "Client"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too @@ -610,6 +613,8 @@ namespace AyaNova.PlugIn.V8 private async System.Threading.Tasks.Task ExportHeadOffices(ProgressForm progress) { if (!progress.KeepGoing) return; + progress.Op("Start Head office export"); + progress.SubOp(""); ResetUniqueNames(); var ObjectTypeName = "HeadOffice"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too @@ -690,6 +695,8 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + progress.Op("Start Contract export"); + progress.SubOp(""); var ObjectTypeName = "Contract"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName); @@ -767,6 +774,8 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + progress.Op("Start Loan item export"); + progress.SubOp(""); var ObjectTypeName = "LoanItem"; var RavenObjectName = "LoanUnit"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too @@ -844,6 +853,8 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + progress.Op("Start Parts export"); + progress.SubOp(""); var ObjectTypeName = "Part"; var RavenObjectName = "Part"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too @@ -923,6 +934,8 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + progress.Op("Start Projects export"); + progress.SubOp(""); var ObjectTypeName = "Project"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName); @@ -999,6 +1012,8 @@ namespace AyaNova.PlugIn.V8 { if (!progress.KeepGoing) return; var ObjectTypeName = "PurchaseOrder"; + progress.Op("Start Purchase orders export"); + progress.SubOp(""); //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName); bool ShouldExportCustom = ocf != null; @@ -1064,6 +1079,9 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + + progress.Op("Start Units export"); + progress.SubOp(""); var ObjectTypeName = "Unit"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName); @@ -1141,6 +1159,10 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + + progress.Op("Start Unit models export"); + progress.SubOp(""); + var ObjectTypeName = "UnitModel"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName); @@ -1217,6 +1239,8 @@ namespace AyaNova.PlugIn.V8 { ResetUniqueNames(); if (!progress.KeepGoing) return; + progress.Op("Start Vendors export"); + progress.SubOp(""); var ObjectTypeName = "Vendor"; //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName); @@ -1292,7 +1316,7 @@ namespace AyaNova.PlugIn.V8 private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress) { if (!progress.KeepGoing) return; - progress.Op("Start service workorder export"); + progress.Op("Start Service workorders export"); progress.SubOp(""); var ObjectTypeName = "Workorder"; var RavenObjectName = "WorkOrder"; @@ -1376,7 +1400,7 @@ namespace AyaNova.PlugIn.V8 private async System.Threading.Tasks.Task ExportQuotes(ProgressForm progress) { if (!progress.KeepGoing) return; - progress.Op("Start Quote export"); + progress.Op("Start Quotes export"); progress.SubOp(""); var ObjectTypeName = "Quote"; var RavenObjectName = "Quote"; @@ -1538,11 +1562,12 @@ namespace AyaNova.PlugIn.V8 } #endregion PM Workorders - #region locales private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress) { if (!progress.KeepGoing) return; + progress.Op("Start Locales export"); + progress.SubOp(""); progress.Append("Exporting customized Locales"); //checksum locales //if a recognized checksum then don't import because it means it wasn't modified from stock @@ -1581,7 +1606,7 @@ namespace AyaNova.PlugIn.V8 int CurrentLocaleHash = util.GetOrderIndependentHashCode(allStrings); allStrings.Clear(); if (StockLocaleHashes.Contains(CurrentLocaleHash)) continue; - progress.Op("Locale " + i.Locale + " is customized"); + progress.Op("Locale " + i.Locale + " is customized; exporting"); //collection to hold items sent to server List exportItems = new List(); @@ -1593,19 +1618,26 @@ namespace AyaNova.PlugIn.V8 var RavenLocaleName = RavenLanguageList.Find(m => m.Id == x).Name; //add stock locale mappings in case users are set to a stock one in v7 //so can set them later + //this is some half baked shit,it's intended for when users are exported later but it only works with stock locales + //so..not sure the exact point, maybe should just default all to english and let admin fix them later + //as they likely will have to anyway. Harmless though I guess so keeping switch (RavenLocaleName) { case "en": - LocaleMap.Add("English", x); + if (!LocaleMap.ContainsKey("English")) + LocaleMap.Add("English", x); break; case "fr": - LocaleMap.Add("Français", x); + if (!LocaleMap.ContainsKey("Français")) + LocaleMap.Add("Français", x); break; case "de": - LocaleMap.Add("Deutsch", x); + if (!LocaleMap.ContainsKey("Deutsch")) + LocaleMap.Add("Deutsch", x); break; case "es": - LocaleMap.Add("Español", x); + if (!LocaleMap.ContainsKey("Español")) + LocaleMap.Add("Español", x); break; } @@ -1623,7 +1655,7 @@ namespace AyaNova.PlugIn.V8 //add to maps so can set user to it on export //going to default to the English based one because //that's the majority of the users - if (RavenLocaleName == "en") + if (RavenLocaleName == "en" && !LocaleMap.ContainsKey(i.Locale)) LocaleMap.Add(i.Locale, targetTranslationId); //Ok, have our target locale created, not we need to insert our custom translations one by one var trans = ((JArray)a.ObjectResponse["data"]["translationItems"]).ToObject>(); @@ -1634,7 +1666,7 @@ namespace AyaNova.PlugIn.V8 //iterate v7 locale items foreach (var v7item in lt.LT) { - + progress.SubOp("Processing key: " + v7item.Key); var v8key = Translatev7TranslationKey(v7item.Key); @@ -1666,6 +1698,9 @@ namespace AyaNova.PlugIn.V8 await util.PutAsync("Translation/UpdateTranslationItemsDisplayText", JArray.FromObject(exportItems).ToString()); + progress.Op(""); + progress.SubOp(""); + } } @@ -1811,9 +1846,9 @@ namespace AyaNova.PlugIn.V8 s = s.Replace("CustomerRequestPartCustomerServiceRequestItemID", "CustomerRequestItemId"); // WorkorderService.Label.WorkorderPreventiveMaintenanceWorkorderID, destination key WorkOrderPMWorkOrderID - - - + + + //FUTURE // s = s.Replace("WASXXX", "NOWXXXX"); // s = s.Replace("WASXXX", "NOWXXXX");