This commit is contained in:
2021-01-08 20:55:44 +00:00
parent f60ec4af0d
commit 6beba72675

View File

@@ -2616,6 +2616,96 @@ namespace AyaNova.PlugIn.V8
#region ClientServiceRequests
private async System.Threading.Tasks.Task ExportClientServiceRequests(ProgressForm progress)
{
ResetUniqueNames();
if (!progress.KeepGoing) return;
progress.Op("Start ClientServiceRequests export");
progress.SubOp("");
var ObjectTypeName = "ClientServiceRequest";
//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;
var DateCustomFields = await ExportCustomFieldSchema(ocf, ObjectTypeName, ObjectTypeName);
//Step 2: export the objects
PickListAutoComplete pl = PickListAutoComplete.GetList("**", "ClientServiceRequest");
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
foreach (PickListAutoComplete.PickListAutoCompleteInfo i in pl)
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
ClientServiceRequest c = ClientServiceRequest.GetItem(i.ID);
var ObjectTID = new TypeAndID(RootObjectTypes.ClientServiceRequest, c.ID);
dynamic d = new JObject();
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.dateStarted = util.DateToV8(c.DateStarted, true);
d.dateCompleted = util.DateToV8(c.DateCompleted, false);
d.accountNumber = c.AccountNumber;
d.ClientServiceRequestOverseerId = SafeGetUserMap(c.ClientServiceRequestOverseerID);
TagFromv7Guid(c.RegionID, tags);
SetTags(d, tags);
//Custom fields?
if (ShouldExportCustom)
d.customFields = CustomFieldData(c, DateCustomFields);
var rMainObject = await util.PostAsync("ClientServiceRequest", 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("ClientServiceRequest", d.ToString());
//-----
//Event log fixup
await util.EventLog(util.AyaType.ClientServiceRequest, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
}
}
#endregion ClientServiceRequests
//###############################################################################################################
//###############################################################################################################
//###############################################################################################################
//###############################################################################################################
//###############################################################################################################
//###############################################################################################################
#region locales
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
{