This commit is contained in:
2021-08-18 18:01:52 +00:00
parent 6da7b13de5
commit 9d240b17ee
2 changed files with 75 additions and 154 deletions

View File

@@ -101,7 +101,7 @@
//
// edTags
//
this.edTags.Location = new System.Drawing.Point(26, 151);
this.edTags.Location = new System.Drawing.Point(26, 160);
this.edTags.Name = "edTags";
this.edTags.Size = new System.Drawing.Size(141, 20);
this.edTags.TabIndex = 40;
@@ -110,7 +110,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 132);
this.label1.Location = new System.Drawing.Point(26, 141);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(120, 13);
this.label1.TabIndex = 41;

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion
{
get { return "7.6.1-alpha.122"; }
get { return "7.6.1-alpha.122.B"; }
}
public string About
@@ -499,11 +499,22 @@ namespace AyaNova.PlugIn.V8
var hasWiki = WikiPage.HasWiki(User.AdministratorID);
if (hasWiki)
{
await ExportAttachments(adminTid, progress);
await ExportAttachments(adminTid, progress, util.AyaType.NoType);//admin account
AdminWikiContent = GetWikiContent(adminTid);
}
//docs
string NonFileUrls = await ExportDocs(adminTid, admin.Docs, progress, util.AyaType.NoType);//admin account
if (!string.IsNullOrEmpty(NonFileUrls))
{
//need to repost the user with the notes modified
var a = await util.GetAsync("user/1");
dynamic d = a.ObjectResponse["data"];
d.login = null;
d.password = null;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
await util.PutAsync("user", d.ToString());
}
string adminCustomFields = null;
//Custom fields?
@@ -521,6 +532,8 @@ namespace AyaNova.PlugIn.V8
d.id = 1;
d.wiki = AdminWikiContent;
d.customFields = CustomFieldData(admin, DateCustomFields);
d.login = null;//do not update the login / password
d.password = null;
await util.PutAsync("user", d.ToString());
}
@@ -554,13 +567,6 @@ namespace AyaNova.PlugIn.V8
d.name = GetUniqueUserName(c.FirstName + " " + c.LastName);
if (IsDuplicatev7v8IdMapItem(c.ID, c.FirstName + " " + c.LastName, progress)) continue;
progress.Op("User " + d.name);
//throw new System.Exception("TODO: UserTypes sb done differently now to align");
//TODO: User type
//d.userType = (int)c.UserType;
//todo: this needs to be adjusted later
//after vendor, customer and headoffice objects are all exported
//then loop through all users again here and set them accordingly if required
//RAVEN user types are different numbers so even the regular ones need to be set alternatively
switch (c.UserType)
@@ -620,28 +626,27 @@ namespace AyaNova.PlugIn.V8
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.User);
//-----
bool repost = false;
d = rMainObject.ObjectResponse["data"];
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
{
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.User);
if (!string.IsNullOrEmpty(NonFileUrls))
{
//need to repost the user with the notes modified
d.login = null;
d.password = null;
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -798,7 +803,7 @@ namespace AyaNova.PlugIn.V8
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.User);
//-----
bool repost = false;
@@ -806,20 +811,19 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.User);
if (!string.IsNullOrEmpty(NonFileUrls))
{
//need to repost the user with the notes modified
d.login = null;
d.password = null;
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -984,7 +988,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.Customer);
//-----
bool repost = false;
@@ -992,16 +996,15 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Customer);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -1193,7 +1196,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.HeadOffice);
//-----
bool repost = false;
@@ -1201,16 +1204,16 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.HeadOffice);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -1350,7 +1353,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.Contract);
//-----
bool repost = false;
@@ -1358,16 +1361,16 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Contract);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -1439,7 +1442,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.LoanUnit);
//-----
bool repost = false;
@@ -1447,16 +1450,16 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.LoanUnit);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -1468,91 +1471,7 @@ namespace AyaNova.PlugIn.V8
}
}
//todo: maybe, seems as though only v8 has a field in the loanitem for woid and v7 doesn't so...??
//perhaps v8 is automatically flagging it when the woitemloan record is created?
// private async System.Threading.Tasks.Task FlagWoForLoanItems(ProgressForm progress)
// {
// if (!progress.KeepGoing) return;
// progress.Op("Start update loan items with current work order id");
// progress.SubOp("");
// PickListAutoComplete pl = PickListAutoComplete.GetList("**", "loanitem");
// foreach (PickListAutoComplete.PickListAutoCompleteInfo i in pl)
// {
// if (!progress.KeepGoing) return;
// LoanItem c = LoanItem.GetItem(i.ID);
// dynamic d = new JObject();
// if(c.l!=guid.empty){
// d= (await util.GetAsync("loan-unit/"+ Getv7v8IdMap(i.ID,"loan item for updat of workorder"))).objectResponse;
//d.workorderItemLoanId=
// }
// d.name = GetUniqueName(c.Name);
// if (IsDuplicatev7v8IdMapItem(c.ID, c.Name, progress)) continue;
// progress.Op(ObjectTypeName + " " + d.name);
// d.active = c.Active;
// d.notes = c.Notes;
// d.serial = c.Serial;
// //MIGRATE_OUTSTANDING
// //fixup after workorders
// //
// d.rateHour = c.RateHour;
// d.rateHalfDay = c.RateHalfDay;
// d.rateDay = c.RateDay;
// d.rateWeek = c.RateWeek;
// d.rateMonth = c.RateMonth;
// d.rateYear = c.RateYear;
// d.defaultRate = 1;
// TagFromv7Guid(c.RegionID, tags);
// SetTags(d, tags);
// //Custom fields?
// if (ShouldExportCustom)
// d.customFields = CustomFieldData(c, DateCustomFields);
// var rMainObject = await util.PostAsync("loan-unit", d.ToString());
// long RavenId = util.IdFromResponse(rMainObject);
// Addv7v8IdMap(c.ID, RavenId);
// //Attachments / FILES
// await ExportAttachments(ObjectTID, progress);
// //-----
// bool repost = false;
// d = rMainObject.ObjectResponse["data"];
// // wiki
// if (WikiPage.HasWiki(c.ID))
// {
// // await ExportAttachments(ObjectTID, progress);
// d.wiki = GetWikiContent(ObjectTID);
// repost = true;
// }
// //docs
// string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
// if (!string.IsNullOrEmpty(NonFileUrls))
// {
// d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
// repost = true;
// }
// if (repost)
// await util.PutAsync("loan-unit", d.ToString());
// //-----
// //Event log fixup
// await util.EventLog(util.AyaType.LoanUnit, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
// }
// }
#endregion LoanItems
@@ -1641,7 +1560,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.Part);
//-----
bool repost = false;
@@ -1649,16 +1568,16 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Part);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -1853,22 +1772,22 @@ namespace AyaNova.PlugIn.V8
long RavenId = util.IdFromResponse(rMainObject);
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.Project);
//-----
bool repost = false;
d = rMainObject.ObjectResponse["data"];
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Project);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -2027,7 +1946,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.PurchaseOrder);
//-----
bool repost = false;
@@ -2035,7 +1954,7 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
@@ -2197,7 +2116,7 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.Unit);
//-----
bool repost = false;
@@ -2205,16 +2124,16 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Unit);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -2324,23 +2243,23 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.UnitModel);
//-----
bool repost = false;
d = rMainObject.ObjectResponse["data"];
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.UnitModel);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -2440,23 +2359,23 @@ namespace AyaNova.PlugIn.V8
Addv7v8IdMap(c.ID, RavenId);
//Attachments / FILES
await ExportAttachments(ObjectTID, progress);
await ExportAttachments(ObjectTID, progress, util.AyaType.Vendor);
//-----
bool repost = false;
d = rMainObject.ObjectResponse["data"];
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
repost = true;
}
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Vendor);
if (!string.IsNullOrEmpty(NonFileUrls))
{
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
repost = true;
}
if (repost)
@@ -2887,7 +2806,7 @@ namespace AyaNova.PlugIn.V8
// wiki
if (WikiPage.HasWiki(c.ID))
{
// await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID);
}
@@ -2900,7 +2819,7 @@ namespace AyaNova.PlugIn.V8
//d.login = null;
//d.password = null;
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
}
@@ -3440,7 +3359,7 @@ namespace AyaNova.PlugIn.V8
//Attachments / FILES
await ExportAttachments(ObjectTID, progress, util.AyaType.WorkOrder);
await ExportAttachments(ObjectTID, progress, util.AyaType.Quote);
//-----
@@ -3449,9 +3368,9 @@ namespace AyaNova.PlugIn.V8
d.wiki = GetWikiContent(ObjectTID);
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.WorkOrder);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Quote);
if (!string.IsNullOrEmpty(NonFileUrls))
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
//put the header object
await util.PutAsync("quote", d.ToString());
@@ -3780,7 +3699,7 @@ namespace AyaNova.PlugIn.V8
//Attachments / FILES
await ExportAttachments(ObjectTID, progress, util.AyaType.WorkOrder);
await ExportAttachments(ObjectTID, progress, util.AyaType.PM);
//-----
@@ -3789,9 +3708,9 @@ namespace AyaNova.PlugIn.V8
d.wiki = GetWikiContent(ObjectTID);
//docs
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.WorkOrder);
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.PM);
if (!string.IsNullOrEmpty(NonFileUrls))
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
d.notes = d.notes + "\n-----------------\n" + NonFileUrls;
//put the header object
await util.PutAsync("pm", d.ToString());
@@ -5096,7 +5015,8 @@ namespace AyaNova.PlugIn.V8
#endregion custom fields
#region Attachments exporter
private async System.Threading.Tasks.Task ExportAttachments(TypeAndID tid, ProgressForm progress, util.AyaType specificRavenType = util.AyaType.NoType)
private async System.Threading.Tasks.Task ExportAttachments(TypeAndID tid, ProgressForm progress, util.AyaType specificRavenType)
{
if (!WikiPage.HasWiki(tid.ID)) return;
@@ -5188,7 +5108,8 @@ namespace AyaNova.PlugIn.V8
#endregion attachments
#region Assigned docs exporter
private async System.Threading.Tasks.Task<string> ExportDocs(TypeAndID tid, AssignedDocs docs, ProgressForm progress, util.AyaType specificRavenType = util.AyaType.NoType)
private async System.Threading.Tasks.Task<string> ExportDocs(TypeAndID tid, AssignedDocs docs, ProgressForm progress, util.AyaType specificRavenType)
{