This commit is contained in:
2021-08-09 19:37:15 +00:00
parent ea8c05bd27
commit 726152780e

View File

@@ -237,6 +237,12 @@ namespace AyaNova.PlugIn.V8
private Dictionary<string, long> LocaleMap = new Dictionary<string, long>();
private string ImportTag = "v7-import";
private static void AddImportTag(List<string> tags){
if(!string.IsNullOrWhiteSpace(ImportTag))
tags.Add(ImportTag);
}
private bool ExportAssignedDocs = false;
/// <summary>
/// Dump the objects into a temporary directory as a series of JSON files
@@ -523,7 +529,7 @@ namespace AyaNova.PlugIn.V8
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
//skip administrator user fields
//but do export administrator
@@ -681,7 +687,7 @@ namespace AyaNova.PlugIn.V8
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
//skip administrator user fields
//but do export administrator
@@ -857,7 +863,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Client c = Client.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.Client, c.ID);
@@ -1114,7 +1120,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
HeadOffice c = HeadOffice.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.HeadOffice, c.ID);
@@ -1282,7 +1288,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Contract c = Contract.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.Contract, c.ID);
@@ -1392,7 +1398,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
LoanItem c = LoanItem.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.LoanItem, c.ID);
@@ -1485,7 +1491,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Part c = Part.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.Part, c.ID);
@@ -1573,7 +1579,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Project c = Project.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.Project, c.ID);
@@ -1654,7 +1660,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
PurchaseOrder c = PurchaseOrder.GetItem(i.LT_PurchaseOrder_Label_PONumber.Value);
//get receipts for this PO
@@ -1731,7 +1737,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Unit c = Unit.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.Unit, c.ID);
@@ -1880,7 +1886,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
UnitModel c = UnitModel.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.UnitModel, c.ID);
@@ -1976,7 +1982,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Vendor c = Vendor.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.Vendor, c.ID);
@@ -2092,7 +2098,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
dynamic d = new JObject();
d.name = GetUniqueName(i.Name);
@@ -2157,7 +2163,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
dynamic d = new JObject();
d.name = GetUniqueName(i.Name);
@@ -2195,7 +2201,7 @@ namespace AyaNova.PlugIn.V8
var ObjectTypeName = "Memo";
progress.Append("Exporting all " + " " + ObjectTypeName + "s");
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
//Get all user id's then get all memo id's for each user id then fetch each memo and finally export
UserPickList upl = UserPickList.GetList(false);
@@ -2267,7 +2273,8 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Workorder c = Workorder.GetItem(i.LT_O_Workorder.Value);
if (IsDuplicatev7v8IdMapItem(c.ID, c.WorkorderService.ServiceNumber.ToString(), progress)) continue;
@@ -2368,7 +2375,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Workorder c = Workorder.GetItem(i.LT_O_WorkorderQuote.Value);
if (IsDuplicatev7v8IdMapItem(c.ID, c.WorkorderQuote.QuoteNumber.ToString(), progress)) continue;
@@ -2448,7 +2455,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
Workorder c = Workorder.GetItem(i.LT_O_WorkorderPreventiveMaintenance.Value);
if (IsDuplicatev7v8IdMapItem(c.ID, c.WorkorderPreventiveMaintenance.PreventiveMaintenanceNumber.ToString(), progress)) continue;
@@ -2532,7 +2539,7 @@ namespace AyaNova.PlugIn.V8
if (c.IsFollowUp)
{
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
dynamic d = new JObject();
//It's a Review / followup tied to another object that should have already been migrated
@@ -2610,7 +2617,7 @@ namespace AyaNova.PlugIn.V8
foreach (Guid gUserId in c.ScheduleableUsersMarkerAppliesTo)
{
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
dynamic d = new JObject();
if (!V7ToV8IdMap.ContainsKey(gUserId))
{
@@ -2743,7 +2750,7 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
AddImportTag(tags);
ClientServiceRequest c = ClientServiceRequest.GetItem(i.LT_O_ClientServiceRequest.Value);
var ObjectTID = new TypeAndID(RootObjectTypes.ClientServiceRequest, c.ID);