This commit is contained in:
@@ -212,6 +212,8 @@ namespace AyaNova.PlugIn.V8
|
||||
Regions export wiki to user
|
||||
|
||||
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
|
||||
|
||||
todo: export docs, settle on "Export" and edit all references to Import to switch it around as it's probably confusing artifact from dbdump days
|
||||
|
||||
@@ -424,7 +426,7 @@ namespace AyaNova.PlugIn.V8
|
||||
Tagit(cert.UserCertificationID, tags);
|
||||
}
|
||||
SetTags(d, tags);
|
||||
|
||||
|
||||
//Custom fields?
|
||||
if (ShouldExportCustom)
|
||||
d.customFields = CustomFieldData(c, DateCustomFields);
|
||||
@@ -467,7 +469,7 @@ namespace AyaNova.PlugIn.V8
|
||||
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;
|
||||
@@ -529,7 +531,7 @@ namespace AyaNova.PlugIn.V8
|
||||
Tagit(c.ClientGroupID, tags);
|
||||
SetTags(d, tags);
|
||||
|
||||
|
||||
|
||||
//Custom fields?
|
||||
if (ShouldExportCustom)
|
||||
d.customFields = CustomFieldData(c, DateCustomFields);
|
||||
@@ -642,7 +644,7 @@ namespace AyaNova.PlugIn.V8
|
||||
repost = true;
|
||||
}
|
||||
if (repost)
|
||||
await util.PutAsync(ObjectTypeName+"/" + RavenId.ToString(), d.ToString());
|
||||
await util.PutAsync(ObjectTypeName + "/" + RavenId.ToString(), d.ToString());
|
||||
//-----
|
||||
|
||||
//Event log fixup
|
||||
@@ -683,7 +685,7 @@ namespace AyaNova.PlugIn.V8
|
||||
Tagit(c.RegionID, tags);
|
||||
SetTags(d, tags);
|
||||
|
||||
|
||||
|
||||
//Custom fields?
|
||||
if (ShouldExportCustom)
|
||||
d.customFields = CustomFieldData(c, DateCustomFields);
|
||||
@@ -837,7 +839,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
SetTags(d, tags);
|
||||
|
||||
|
||||
|
||||
//Custom fields?
|
||||
if (ShouldExportCustom)
|
||||
d.customFields = CustomFieldData(c, DateCustomFields);
|
||||
@@ -1010,7 +1012,7 @@ namespace AyaNova.PlugIn.V8
|
||||
repost = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (repost)
|
||||
await util.PutAsync(ObjectTypeName + "/" + RavenId.ToString(), d.ToString());
|
||||
//-----
|
||||
@@ -1201,7 +1203,7 @@ namespace AyaNova.PlugIn.V8
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.active = c.Active;
|
||||
d.notes = c.Notes;
|
||||
|
||||
|
||||
SetTags(d, tags);
|
||||
|
||||
|
||||
@@ -1274,7 +1276,7 @@ namespace AyaNova.PlugIn.V8
|
||||
Workorder c = Workorder.GetItem(i.LT_O_Workorder.Value);
|
||||
var ObjectTID = new TypeAndID(RootObjectTypes.WorkorderService, c.ID);
|
||||
//make one on the server to update
|
||||
var rMainObject = await util.PostAsync(RavenObjectName+"/Create?serial="+c.WorkorderService.ServiceNumber);
|
||||
var rMainObject = await util.PostAsync(RavenObjectName + "/Create?serial=" + c.WorkorderService.ServiceNumber);
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
Map.Add(c.ID, RavenId);
|
||||
|
||||
@@ -1282,7 +1284,7 @@ namespace AyaNova.PlugIn.V8
|
||||
d.concurrencyToken = util.CTokenFromResponse(rMainObject);
|
||||
progress.Op(ObjectTypeName + " " + c.WorkorderService.ServiceNumber);
|
||||
d.active = true;//probably can remove this at server, just stubbed in for now
|
||||
|
||||
|
||||
Tagit(c.RegionID, tags);
|
||||
SetTags(d, tags);
|
||||
|
||||
@@ -1290,11 +1292,11 @@ namespace AyaNova.PlugIn.V8
|
||||
//if (ShouldExportCustom)
|
||||
// d.customFields = CustomFieldData(c, DateCustomFields);
|
||||
|
||||
// var rMainObject = await util.PostAsync(RavenObjectName, d.ToString());
|
||||
|
||||
// var rMainObject = await util.PostAsync(RavenObjectName, d.ToString());
|
||||
|
||||
|
||||
//Attachments / FILES
|
||||
await ExportAttachments(ObjectTID, progress);
|
||||
await ExportAttachments(ObjectTID, progress, util.AyaType.WorkOrderItem);
|
||||
|
||||
//-----
|
||||
bool repost = false;
|
||||
@@ -1832,7 +1834,7 @@ namespace AyaNova.PlugIn.V8
|
||||
#endregion custom fields
|
||||
|
||||
#region Attachments exporter
|
||||
private async System.Threading.Tasks.Task ExportAttachments(TypeAndID tid, ProgressForm progress)
|
||||
private async System.Threading.Tasks.Task ExportAttachments(TypeAndID tid, ProgressForm progress, util.AyaType specificRavenType = util.AyaType.NoType)
|
||||
{
|
||||
if (!WikiPage.HasWiki(tid.ID)) return;
|
||||
|
||||
@@ -1873,7 +1875,12 @@ namespace AyaNova.PlugIn.V8
|
||||
MultipartFormDataContent formDataContent = new MultipartFormDataContent();
|
||||
|
||||
//Form data like the bizobject type and id
|
||||
formDataContent.Add(new StringContent(((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString()), name: "AttachToObjectType");
|
||||
string RavenTypeAsString = "";
|
||||
if (specificRavenType != util.AyaType.NoType)
|
||||
RavenTypeAsString = ((int)specificRavenType).ToString();
|
||||
else
|
||||
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
|
||||
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
|
||||
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
|
||||
formDataContent.Add(new StringContent(ImportTag), name: "Notes");
|
||||
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||
@@ -1900,14 +1907,14 @@ namespace AyaNova.PlugIn.V8
|
||||
//Map it for later processing of wiki
|
||||
//attachment upload route returns all attachments for this object in file name order
|
||||
//so need to find *our* most recent uploaded attachment so need to find the highest raven id number
|
||||
var returnArray=((JArray)a.ObjectResponse["data"]);
|
||||
var returnArray = ((JArray)a.ObjectResponse["data"]);
|
||||
var ravenId = -1L;
|
||||
foreach (JObject o in returnArray)
|
||||
{
|
||||
var oId = o["id"].Value<long>();
|
||||
if (oId > ravenId) ravenId = oId;
|
||||
if (oId > ravenId) ravenId = oId;
|
||||
}
|
||||
|
||||
|
||||
Map.Add(af.ID, ravenId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user