diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 374e725..8bdb109 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -194,7 +194,7 @@ namespace AyaNova.PlugIn.V8 private void Addv7v8WorkOrderItemStatusIdMap(Guid v7id, long v8id) { if (V7ToV8WorkOrderItemStatusIdMap.ContainsKey(v7id)) - throw new Exception("Error: V7ToV8WorkOrderItemStatusIdMap - v7id already mapped previously, id is " + v7id.ToString()); + throw new Exception("Error: V7ToV8WorkOrderItemStatusIdMap - v7id already mapped previously, id is " + v7id.ToString()); else V7ToV8WorkOrderItemStatusIdMap.Add(v7id, v8id); } @@ -2268,7 +2268,7 @@ namespace AyaNova.PlugIn.V8 progress.Op("Start WorkOrderItem Priority export"); progress.SubOp(""); var ObjectTypeName = "WorkorderItem Priority"; - progress.Append("Exporting all "+ ObjectTypeName + " objects"); + progress.Append("Exporting all " + ObjectTypeName + " objects"); List tags = new List(); AddImportTag(tags); Priorities w = Priorities.GetItems(); @@ -2298,7 +2298,7 @@ namespace AyaNova.PlugIn.V8 #region WorkorderStatus private async System.Threading.Tasks.Task ExportWorkorderStatus(ProgressForm progress) - { + { if (!progress.KeepGoing) return; progress.Op("Start WorkOrder/Item Status export"); progress.SubOp(""); @@ -2316,7 +2316,7 @@ namespace AyaNova.PlugIn.V8 if (!progress.KeepGoing) return; dynamic d = new JObject(); d.name = GetUniqueName(s.Name); - progress.Op("WorkOrder status " + d.name); + progress.Op("WorkOrder status " + d.name); d.active = s.Active; d.locked = false; d.completed = false; @@ -2339,7 +2339,7 @@ namespace AyaNova.PlugIn.V8 dynamic d = new JObject(); d.name = GetUniqueName(s.Name); progress.Op("WorkOrder ITEM status " + d.name); - d.active = s.Active; + d.active = s.Active; d.color = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(s.ARGB)); SetTags(d, tags); var rMainObject = await util.PostAsync("work-order-item-status", d.ToString()); @@ -2402,6 +2402,42 @@ namespace AyaNova.PlugIn.V8 var ObjectTID = new TypeAndID(RootObjectTypes.WorkorderService, c.ID); dynamic d = new JObject(); progress.Op(ObjectTypeName + " " + c.WorkorderService.ServiceNumber); + + d.serial = c.WorkorderService.ServiceNumber; + d.customerId = Getv7v8IdMap(c.ClientID, "Client for wo " + d.serial); + d.notes = c.Summary; + d.projectId = Getv7v8IdMapNullOk(c.ProjectID); + d.internalReferenceNumber = c.InternalReferenceNumber; + d.customerReferenceNumber = c.CustomerReferenceNumber; + d.customerContactName = c.CustomerContactName; + d.createdDate = util.DateToV8(c.Created, true); + d.serviceDate = util.DateToV8(c.WorkorderService.ServiceDate); + d.completeByDate = util.DateToV8(c.WorkorderService.CloseByDate); + d.invoiceNumber = c.WorkorderService.InvoiceNumber; + d.onsite = c.Onsite; + d.contractId = Getv7v8IdMapNullOk(c.ContractIDResolved()); + d.lastStatusId = Getv7v8IdMapNullOk(c.WorkorderService.WorkorderStatusID); + + //TODO: signatures, Addresses + var client = c.uiClient; + if (client != null) + { + d.postAddress = client.MailToAddress.DeliveryAddress; + d.postCity = client.MailToAddress.City; + d.postRegion = client.MailToAddress.StateProv; + d.postCode = client.MailToAddress.Postal; + d.address = client.GoToAddress.DeliveryAddress; + d.city = client.GoToAddress.City; + d.region = client.GoToAddress.StateProv; + d.country = client.GoToAddress.Country; + d.latitude = client.GoToAddress.Latitude; + d.longitude = client.GoToAddress.Longitude; + } + + + + + TagFromv7Guid(c.RegionID, tags); SetTags(d, tags); @@ -2409,8 +2445,7 @@ namespace AyaNova.PlugIn.V8 long RavenId = util.IdFromResponse(rMainObject); Addv7v8IdMap(c.ID, RavenId); d = rMainObject.ObjectResponse["data"]; - d.serial = c.WorkorderService.ServiceNumber; - d.notes = c.Summary; + //Attachments / FILES await ExportAttachments(ObjectTID, progress, util.AyaType.WorkOrder); @@ -3575,7 +3610,7 @@ namespace AyaNova.PlugIn.V8 d.template = dtemplate.ToString(); //ok, were here because there *are* custom fields available - + var a = await util.GetAsync("form-custom/" + formCustomKey); var RavenFormCustomId = util.IdFromResponse(a); var ctoken = util.CTokenFromResponse(a);