This commit is contained in:
2020-05-04 22:06:26 +00:00
parent 895a19932d
commit 54c896346b
2 changed files with 56 additions and 21 deletions

View File

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.6.0.0")] [assembly: AssemblyVersion("7.6.0.0")]
[assembly: AssemblyFileVersion("7.6.3.0")] [assembly: AssemblyFileVersion("7.6.0.0")]

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion public string PluginVersion
{ {
get { return "7.6 (patch 3)"; } get { return "7.6"; }
} }
public string About public string About
@@ -50,7 +50,7 @@ namespace AyaNova.PlugIn.V8
public Guid PluginID 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 public System.Drawing.Image PluginSmallIcon
@@ -132,13 +132,13 @@ namespace AyaNova.PlugIn.V8
return; return;
} }
#if(!DEBUG) //#if(!DEBUG)
if (!AyaBizUtils.AyaNovaConnectionSetting.SingleUserConnection) 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 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. ***"); 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(); Auth d = new Auth();
var res = d.ShowDialog(); ; 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 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 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 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) catch (Exception ex)
{ {
progress.Append("ERROR, During operation: " + progress.LastOp + "\n" + progress.LastSubOp); progress.Append("ERROR, During operation: \n" + progress.LastOp + "\n" + progress.LastSubOp);
progress.Append("\n************\nExport failed with error:"); progress.Append("\n************\nExport failed with error:\n");
progress.Append(ex.Message); progress.Append(ex.Message);
progress.Append("stack:\n" + ex.StackTrace); progress.Append("stack:\n" + ex.StackTrace);
} }
@@ -348,6 +347,8 @@ namespace AyaNova.PlugIn.V8
private async System.Threading.Tasks.Task ExportUsers(ProgressForm progress) private async System.Threading.Tasks.Task ExportUsers(ProgressForm progress)
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start User export");
progress.SubOp("");
ResetUniqueNames(); ResetUniqueNames();
//Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too //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) private async System.Threading.Tasks.Task ExportClients(ProgressForm progress)
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Client export");
progress.SubOp("");
ResetUniqueNames(); ResetUniqueNames();
var ObjectTypeName = "Client"; 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 //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) private async System.Threading.Tasks.Task ExportHeadOffices(ProgressForm progress)
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Head office export");
progress.SubOp("");
ResetUniqueNames(); ResetUniqueNames();
var ObjectTypeName = "HeadOffice"; 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 //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(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Contract export");
progress.SubOp("");
var ObjectTypeName = "Contract"; 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 //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); var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
@@ -767,6 +774,8 @@ namespace AyaNova.PlugIn.V8
{ {
ResetUniqueNames(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Loan item export");
progress.SubOp("");
var ObjectTypeName = "LoanItem"; var ObjectTypeName = "LoanItem";
var RavenObjectName = "LoanUnit"; 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 //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(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Parts export");
progress.SubOp("");
var ObjectTypeName = "Part"; var ObjectTypeName = "Part";
var RavenObjectName = "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 //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(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Projects export");
progress.SubOp("");
var ObjectTypeName = "Project"; 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 //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); var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
@@ -999,6 +1012,8 @@ namespace AyaNova.PlugIn.V8
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
var ObjectTypeName = "PurchaseOrder"; 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 //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); var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
bool ShouldExportCustom = ocf != null; bool ShouldExportCustom = ocf != null;
@@ -1064,6 +1079,9 @@ namespace AyaNova.PlugIn.V8
{ {
ResetUniqueNames(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Units export");
progress.SubOp("");
var ObjectTypeName = "Unit"; 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 //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); var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
@@ -1141,6 +1159,10 @@ namespace AyaNova.PlugIn.V8
{ {
ResetUniqueNames(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Unit models export");
progress.SubOp("");
var ObjectTypeName = "UnitModel"; 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 //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); var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
@@ -1217,6 +1239,8 @@ namespace AyaNova.PlugIn.V8
{ {
ResetUniqueNames(); ResetUniqueNames();
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Vendors export");
progress.SubOp("");
var ObjectTypeName = "Vendor"; 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 //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); var ocf = ObjectHasCustomFieldDataToExport(ObjectTypeName);
@@ -1292,7 +1316,7 @@ namespace AyaNova.PlugIn.V8
private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress) private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress)
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start service workorder export"); progress.Op("Start Service workorders export");
progress.SubOp(""); progress.SubOp("");
var ObjectTypeName = "Workorder"; var ObjectTypeName = "Workorder";
var RavenObjectName = "WorkOrder"; var RavenObjectName = "WorkOrder";
@@ -1376,7 +1400,7 @@ namespace AyaNova.PlugIn.V8
private async System.Threading.Tasks.Task ExportQuotes(ProgressForm progress) private async System.Threading.Tasks.Task ExportQuotes(ProgressForm progress)
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Quote export"); progress.Op("Start Quotes export");
progress.SubOp(""); progress.SubOp("");
var ObjectTypeName = "Quote"; var ObjectTypeName = "Quote";
var RavenObjectName = "Quote"; var RavenObjectName = "Quote";
@@ -1538,11 +1562,12 @@ namespace AyaNova.PlugIn.V8
} }
#endregion PM Workorders #endregion PM Workorders
#region locales #region locales
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress) private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
progress.Op("Start Locales export");
progress.SubOp("");
progress.Append("Exporting customized Locales"); progress.Append("Exporting customized Locales");
//checksum locales //checksum locales
//if a recognized checksum then don't import because it means it wasn't modified from stock //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<string>(allStrings); int CurrentLocaleHash = util.GetOrderIndependentHashCode<string>(allStrings);
allStrings.Clear(); allStrings.Clear();
if (StockLocaleHashes.Contains(CurrentLocaleHash)) continue; 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 //collection to hold items sent to server
List<UpdateTranslationItem> exportItems = new List<UpdateTranslationItem>(); List<UpdateTranslationItem> exportItems = new List<UpdateTranslationItem>();
@@ -1593,19 +1618,26 @@ namespace AyaNova.PlugIn.V8
var RavenLocaleName = RavenLanguageList.Find(m => m.Id == x).Name; var RavenLocaleName = RavenLanguageList.Find(m => m.Id == x).Name;
//add stock locale mappings in case users are set to a stock one in v7 //add stock locale mappings in case users are set to a stock one in v7
//so can set them later //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) switch (RavenLocaleName)
{ {
case "en": case "en":
LocaleMap.Add("English", x); if (!LocaleMap.ContainsKey("English"))
LocaleMap.Add("English", x);
break; break;
case "fr": case "fr":
LocaleMap.Add("Français", x); if (!LocaleMap.ContainsKey("Français"))
LocaleMap.Add("Français", x);
break; break;
case "de": case "de":
LocaleMap.Add("Deutsch", x); if (!LocaleMap.ContainsKey("Deutsch"))
LocaleMap.Add("Deutsch", x);
break; break;
case "es": case "es":
LocaleMap.Add("Español", x); if (!LocaleMap.ContainsKey("Español"))
LocaleMap.Add("Español", x);
break; break;
} }
@@ -1623,7 +1655,7 @@ namespace AyaNova.PlugIn.V8
//add to maps so can set user to it on export //add to maps so can set user to it on export
//going to default to the English based one because //going to default to the English based one because
//that's the majority of the users //that's the majority of the users
if (RavenLocaleName == "en") if (RavenLocaleName == "en" && !LocaleMap.ContainsKey(i.Locale))
LocaleMap.Add(i.Locale, targetTranslationId); LocaleMap.Add(i.Locale, targetTranslationId);
//Ok, have our target locale created, not we need to insert our custom translations one by one //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<List<TranslationItem>>(); var trans = ((JArray)a.ObjectResponse["data"]["translationItems"]).ToObject<List<TranslationItem>>();
@@ -1634,7 +1666,7 @@ namespace AyaNova.PlugIn.V8
//iterate v7 locale items //iterate v7 locale items
foreach (var v7item in lt.LT) foreach (var v7item in lt.LT)
{ {
progress.SubOp("Processing key: " + v7item.Key); progress.SubOp("Processing key: " + v7item.Key);
var v8key = Translatev7TranslationKey(v7item.Key); var v8key = Translatev7TranslationKey(v7item.Key);
@@ -1666,6 +1698,9 @@ namespace AyaNova.PlugIn.V8
await util.PutAsync("Translation/UpdateTranslationItemsDisplayText", await util.PutAsync("Translation/UpdateTranslationItemsDisplayText",
JArray.FromObject(exportItems).ToString()); JArray.FromObject(exportItems).ToString());
progress.Op("");
progress.SubOp("");
} }
} }
@@ -1811,9 +1846,9 @@ namespace AyaNova.PlugIn.V8
s = s.Replace("CustomerRequestPartCustomerServiceRequestItemID", "CustomerRequestItemId"); s = s.Replace("CustomerRequestPartCustomerServiceRequestItemID", "CustomerRequestItemId");
// WorkorderService.Label.WorkorderPreventiveMaintenanceWorkorderID, destination key WorkOrderPMWorkOrderID // WorkorderService.Label.WorkorderPreventiveMaintenanceWorkorderID, destination key WorkOrderPMWorkOrderID
//FUTURE //FUTURE
// s = s.Replace("WASXXX", "NOWXXXX"); // s = s.Replace("WASXXX", "NOWXXXX");
// s = s.Replace("WASXXX", "NOWXXXX"); // s = s.Replace("WASXXX", "NOWXXXX");