This commit is contained in:
2021-08-17 17:38:39 +00:00
parent 2f382a5c39
commit e588d006a1

View File

@@ -1428,6 +1428,90 @@ namespace AyaNova.PlugIn.V8
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);
}
}
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.WorkorderLoanId!=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);