This commit is contained in:
@@ -325,6 +325,9 @@ namespace AyaNova.PlugIn.V8
|
||||
// await ExportQuotes(progress);
|
||||
// await ExportPMs(progress);
|
||||
|
||||
//Must be after all root objects due to followups
|
||||
await ExportScheduleMarkers(progress);
|
||||
|
||||
|
||||
//NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export
|
||||
if (progress.KeepGoing)
|
||||
@@ -387,7 +390,7 @@ namespace AyaNova.PlugIn.V8
|
||||
UsedNames.Clear();
|
||||
}
|
||||
|
||||
#region users
|
||||
#region Users
|
||||
|
||||
private async System.Threading.Tasks.Task ExportStaffUsers(ProgressForm progress)
|
||||
{
|
||||
@@ -918,10 +921,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1119,11 +1118,7 @@ namespace AyaNova.PlugIn.V8
|
||||
//docs
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
{
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1242,10 +1237,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1322,10 +1313,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1404,10 +1391,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1488,10 +1471,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1636,10 +1615,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1718,10 +1693,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1838,10 +1809,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -1856,7 +1823,6 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
#endregion Vendors
|
||||
|
||||
|
||||
#region Memos
|
||||
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
|
||||
{
|
||||
@@ -2091,10 +2057,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.Quote);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
//d.login = null;
|
||||
//d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -2175,10 +2137,6 @@ namespace AyaNova.PlugIn.V8
|
||||
string NonFileUrls = await ExportDocs(ObjectTID, c.Docs, progress, util.AyaType.PM);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
|
||||
//d.login = null;
|
||||
//d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
repost = true;
|
||||
}
|
||||
@@ -2194,6 +2152,120 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
#endregion PM Workorders
|
||||
|
||||
#region ScheduleMarkers
|
||||
private async System.Threading.Tasks.Task ExportScheduleMarkers(ProgressForm progress)
|
||||
{
|
||||
ResetUniqueNames();
|
||||
if (!progress.KeepGoing) return;
|
||||
progress.Op("Start ScheduleMarker export");
|
||||
progress.SubOp("");
|
||||
|
||||
|
||||
|
||||
//Step 2: export the objects
|
||||
ScheduleMarkerListAllUsers pl = ScheduleMarkerListAllUsers.GetList(string.Empty);
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " ScheduleMarkers");
|
||||
|
||||
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)
|
||||
{
|
||||
//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());
|
||||
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)) {
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
//Ok we have enough to do the export
|
||||
if (util.DateIsPast(c.StopDate))
|
||||
{
|
||||
//Migrate rule case 3511
|
||||
//past followups v8 dueDate set to v7 stopdate
|
||||
//past followups assumed completed and set v8 completedate to v7 stopdate
|
||||
|
||||
d.dueDate = sStopDate;
|
||||
d.completedDate = sStopDate;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Migrate rule case 3511
|
||||
//Future followups assumed incomplete set completedDate null
|
||||
//due date is v7 stop date
|
||||
}
|
||||
|
||||
//completed is deprecated in v8 so to preserve that info tag the completed ones only
|
||||
if(c.Completed)
|
||||
tags.Add("completed.review");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
#region locales
|
||||
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
|
||||
{
|
||||
|
||||
@@ -367,7 +367,24 @@ namespace AyaNova.PlugIn.V8
|
||||
if (neverEmpty)
|
||||
return DateTime.UtcNow.ToString("o");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
// v7 to v8 Date conversion
|
||||
//
|
||||
//
|
||||
public static bool DateIsPast(object o, bool neverEmpty = false) { return DateIsPast(o.ToString(), neverEmpty); }
|
||||
public static bool DateIsPast(string s, bool neverEmpty = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
return false;//no date so not past
|
||||
|
||||
|
||||
DateTime result = new DateTime();
|
||||
if (DateTime.TryParse(s, out result))
|
||||
return result < DateTime.Now;
|
||||
//can't parse so no, it's not past
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user