This commit is contained in:
@@ -2169,15 +2169,18 @@ namespace AyaNova.PlugIn.V8
|
||||
foreach (ScheduleMarkerListAllUsers.ScheduleMarkerListAllUsersInfo i in pl)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
|
||||
|
||||
ScheduleMarker c = ScheduleMarker.GetItem(i.LT_O_ScheduleMarker.Value);
|
||||
dynamic d = new JObject();
|
||||
|
||||
|
||||
//Many schedulemarkers may not have related records so allow for that!!
|
||||
if (c.IsFollowUp)
|
||||
{
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
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());
|
||||
@@ -2186,6 +2189,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
//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)) {
|
||||
progress.Append("FollowUp User missing; skipping export: UserID " + c.SourceID.ToString());
|
||||
continue;
|
||||
@@ -2223,47 +2227,63 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
d.name = c.Name;
|
||||
d.notes = c.Notes;
|
||||
d.userId = Map[c.SourceID];
|
||||
d.assignedByUserId = SafeGetUserMap(c.Creator);
|
||||
d.objectId = Map[c.FollowID];
|
||||
d.objectType = util.RootObjectToAyaType(c.FollowType);
|
||||
|
||||
SetTags(d, tags);
|
||||
progress.Op("FollowUp " + c.ID.ToString());
|
||||
var rMainObject = await util.PostAsync("review", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
AddMap(c.ID, RavenId);
|
||||
await util.EventLog(util.AyaType.Review, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||
}
|
||||
else
|
||||
{
|
||||
//It's a Reminder schedulemarker
|
||||
|
||||
//ensure has dates
|
||||
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());
|
||||
continue;//skip this schedulemarker entirely it's disqualified
|
||||
}
|
||||
|
||||
foreach (Guid gUserId in c.ScheduleableUsersMarkerAppliesTo)
|
||||
{
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
dynamic d = new JObject();
|
||||
if (!Map.ContainsKey(gUserId))
|
||||
{
|
||||
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");
|
||||
|
||||
d.name = c.Name;
|
||||
d.notes = c.Notes;
|
||||
d.userId = Map[gUserId];
|
||||
d.startDate = sStartDate;
|
||||
d.stopDate = sStopDate;
|
||||
SetTags(d, tags);
|
||||
progress.Op("ScheduleMarker " + c.ID.ToString());
|
||||
var rMainObject = await util.PostAsync("review", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
AddMap(c.ID, RavenId);
|
||||
await util.EventLog(util.AyaType.Review, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
d.name = GetUniqueName(c.Name);
|
||||
if (IsDuplicateMapItem(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.projectOverseerId = SafeGetUserMap(c.ProjectOverseerID);
|
||||
|
||||
Tagit(c.RegionID, tags);
|
||||
SetTags(d, tags);
|
||||
|
||||
|
||||
|
||||
var rMainObject = await util.PostAsync("project", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
AddMap(c.ID, RavenId);
|
||||
|
||||
|
||||
//-----
|
||||
bool repost = false;
|
||||
d = rMainObject.ObjectResponse["data"];
|
||||
|
||||
|
||||
|
||||
//-----
|
||||
|
||||
//Event log fixup
|
||||
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||
|
||||
}
|
||||
}
|
||||
#endregion ScheduleMarkers
|
||||
|
||||
@@ -438,7 +438,8 @@ namespace AyaNova.PlugIn.V8
|
||||
throw new NotImplementedException("V8:util:RootObjectToAyaType -> type " + rot.ToString() + "," + specificWoType.ToString() + " is not coded yet");
|
||||
}
|
||||
|
||||
|
||||
case biz.RootObjectTypes.Memo:
|
||||
return AyaType.Memo;
|
||||
case biz.RootObjectTypes.Project:
|
||||
return AyaType.Project;
|
||||
case biz.RootObjectTypes.PurchaseOrder:
|
||||
|
||||
Reference in New Issue
Block a user