diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 4ef2bcf..d87ec75 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -256,6 +256,7 @@ namespace AyaNova.PlugIn.V8 private bool ExportAssignedDocs = false; private long ClosedWorkOrderStatus = 0; + private long ServiceCompletedWorkOrderStatus = 0; /// /// Dump the objects into a temporary directory as a series of JSON files @@ -2355,12 +2356,12 @@ namespace AyaNova.PlugIn.V8 } - //Third export for service completed / closed status + //Third export for closed status ResetUniqueNames(); { if (!progress.KeepGoing) return; dynamic d = new JObject(); - d.name = GetUniqueName("Closed / Service Completed"); + d.name = GetUniqueName("Closed (v7)"); progress.Op("WorkOrder status " + d.name); d.active = true; d.locked = true; @@ -2376,6 +2377,29 @@ namespace AyaNova.PlugIn.V8 //await util.EventLog(util.AyaType.WorkOrderStatus, RavenId, SafeGetUserMap(s.Creator), SafeGetUserMap(s.Modifier), s.Created, s.Modified); } + //Fourth export for service completed status + ResetUniqueNames(); + { + if (!progress.KeepGoing) return; + dynamic d = new JObject(); + d.name = GetUniqueName("Service Completed (v7)"); + progress.Op("WorkOrder status " + d.name); + d.active = true; + d.locked = true; + d.completed = false; + d.selectRoles = 1290;//biz-admin, service full, service tech, subcontractor + d.removeRoles = 10;//bizadmin,servicefull + d.color = "#BBBBBB"; + d.notes = "This status automatically created by the v8 migrate process for service completed work orders"; + SetTags(d, tags); + var rMainObject = await util.PostAsync("work-order-status", d.ToString()); + ServiceCompletedWorkOrderStatus = util.IdFromResponse(rMainObject); + //Event log fixup + //await util.EventLog(util.AyaType.WorkOrderStatus, RavenId, SafeGetUserMap(s.Creator), SafeGetUserMap(s.Modifier), s.Created, s.Modified); + } + + + //------ @@ -2521,6 +2545,15 @@ namespace AyaNova.PlugIn.V8 state.userId = Getv7v8IdMap(c.Creator, "Workorder creator for status"); await util.PostAsync("workorder/states", state.ToString()); } + if (c.ServiceCompleted) + { + dynamic state = new JObject(); + state.workOrderId = RavenId; + state.workOrderStatusId = ServiceCompletedWorkOrderStatus; + state.created = util.DateToV8(c.Created, true); + state.userId = Getv7v8IdMap(c.Creator, "Workorder creator for status"); + await util.PostAsync("workorder/states", state.ToString()); + } if (c.Closed) { dynamic state = new JObject(); @@ -2530,7 +2563,6 @@ namespace AyaNova.PlugIn.V8 state.userId = Getv7v8IdMap(c.Creator, "Workorder creator for status"); await util.PostAsync("workorder/states", state.ToString()); } - //todo:? maybe if service completed but not closed we have a separate state for that?? }