diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 437ec01..38f44d6 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -1118,7 +1118,7 @@ namespace AyaNova.PlugIn.V8 //docs string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress); if (!string.IsNullOrEmpty(NonFileUrls)) - { + { d.notes = NonFileUrls + "\n-----------------\n" + d.notes; repost = true; } @@ -1437,7 +1437,7 @@ namespace AyaNova.PlugIn.V8 progress.Op(ObjectTypeName + " " + d.name); d.active = c.Active; d.notes = c.Notes; - d.dateStarted = util.DateToV8(c.DateStarted,true); + d.dateStarted = util.DateToV8(c.DateStarted, true); d.dateCompleted = util.DateToV8(c.DateCompleted, false); d.accountNumber = c.AccountNumber; d.projectOverseerId = SafeGetUserMap(c.ProjectOverseerID); @@ -1851,19 +1851,19 @@ namespace AyaNova.PlugIn.V8 dmemo.notes = mem.Message; dmemo.viewed = mem.Viewed; dmemo.replied = mem.Replied; - var RavenFromId=SafeGetUserMap(mem.FromID); + var RavenFromId = SafeGetUserMap(mem.FromID); dmemo.fromId = RavenFromId; dmemo.sent = util.DateToV8(mem.Created, true); - dmemo.toId=SafeGetUserMap(mem.ToID); + dmemo.toId = SafeGetUserMap(mem.ToID); SetTags(dmemo, tags); duserid.Add(-7);//special code to server to treat as an import single d.users = duserid; d.memo = dmemo; - + progress.Op(ObjectTypeName + " " + mem.ID.ToString()); var rMainObject = await util.PostAsync("memo", d.ToString()); - long RavenId = util.IdFromResponse(rMainObject); + long RavenId = util.IdFromResponse(rMainObject); //Event log fixup await util.EventLog(util.AyaType.Project, RavenId, RavenFromId, RavenFromId, mem.Created, mem.Modified); @@ -2159,8 +2159,8 @@ namespace AyaNova.PlugIn.V8 if (!progress.KeepGoing) return; progress.Op("Start ScheduleMarker export"); progress.SubOp(""); - - + + //Step 2: export the objects ScheduleMarkerListAllUsers pl = ScheduleMarkerListAllUsers.GetList(string.Empty); @@ -2169,11 +2169,11 @@ namespace AyaNova.PlugIn.V8 foreach (ScheduleMarkerListAllUsers.ScheduleMarkerListAllUsersInfo i in pl) { if (!progress.KeepGoing) return; - + ScheduleMarker c = ScheduleMarker.GetItem(i.LT_O_ScheduleMarker.Value); - - + + //Many schedulemarkers may not have related records so allow for that!! if (c.IsFollowUp) { @@ -2182,22 +2182,24 @@ namespace AyaNova.PlugIn.V8 dynamic d = new JObject(); //It's a Review / followup tied to another object that should have already been migrated - if (!Map.ContainsKey(c.FollowID)) { - progress.Append("FollowUp target missing; skipping export: ID " +c.ID.ToString() + ",targetid "+c.FollowID.ToString() + ",type " + c.FollowType.ToString()); + if (!Map.ContainsKey(c.FollowID)) + { + progress.Append("FollowUp target missing; skipping export: ID " + c.ID.ToString() + ",targetid " + c.FollowID.ToString() + ",type " + c.FollowType.ToString()); continue; } //export //FollowUps only ever apply to a single user in v7 so no need to split them out here it's just for one user - if (!Map.ContainsKey(c.SourceID)) { + if (!Map.ContainsKey(c.SourceID)) + { progress.Append("FollowUp User missing; skipping export: UserID " + c.SourceID.ToString()); continue; } //ensure has dates - string sStartDate=util.DateToV8(c.StartDate); - string sStopDate=util.DateToV8(c.StopDate); + string sStartDate = util.DateToV8(c.StartDate); + string sStopDate = util.DateToV8(c.StopDate); if (sStartDate == string.Empty || sStopDate == string.Empty) { progress.Append("FollowUp start or stop date missing; skipping export: ID " + c.ID.ToString() + ",targetid " + c.FollowID.ToString() + ",type " + c.FollowType.ToString()); @@ -2222,7 +2224,7 @@ namespace AyaNova.PlugIn.V8 } //completed is deprecated in v8 so to preserve that info tag the completed ones only - if(c.Completed) + if (c.Completed) tags.Add("completed.review"); d.name = c.Name; @@ -2235,7 +2237,7 @@ namespace AyaNova.PlugIn.V8 progress.Op("FollowUp " + c.ID.ToString()); var rMainObject = await util.PostAsync("review", d.ToString()); long RavenId = util.IdFromResponse(rMainObject); - AddMap(c.ID, RavenId); + AddMap(c.ID, RavenId); await util.EventLog(util.AyaType.Review, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified); } else @@ -2260,8 +2262,8 @@ namespace AyaNova.PlugIn.V8 { progress.Append("ScheduleMarker User missing; skipping export: UserID " + c.SourceID.ToString()); continue; - } - + } + //completed is deprecated in v8 so to preserve that info tag the completed ones only if (c.Completed) tags.Add("completed.reminder"); @@ -2276,7 +2278,8 @@ namespace AyaNova.PlugIn.V8 progress.Op("ScheduleMarker " + c.ID.ToString()); var rMainObject = await util.PostAsync("reminder", d.ToString()); long RavenId = util.IdFromResponse(rMainObject); - AddMap(c.ID, RavenId); + if (!Map.ContainsKey(c.ID)) + AddMap(c.ID, RavenId); await util.EventLog(util.AyaType.Review, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified); } }