This commit is contained in:
2020-05-01 00:10:55 +00:00
parent aacb6221dc
commit 4509f92fd5

View File

@@ -158,7 +158,6 @@ namespace AyaNova.PlugIn.V8
private Dictionary<Guid, long> Map = new Dictionary<Guid, long>();
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
private Dictionary<string, string> CustomFieldLocaleKeys = new Dictionary<string, string>();//holds custom field Raven as key and v7 custom text for that field for later export
private Dictionary<string, long> LocaleMap = new Dictionary<string, long>();
private string ImportTag = "v7-import";
@@ -180,7 +179,7 @@ namespace AyaNova.PlugIn.V8
progress.Op("Preparing to export....");
Map.Clear();
TagMap.Clear();
CustomFieldLocaleKeys.Clear();
LocaleMap.Clear();
@@ -193,11 +192,15 @@ namespace AyaNova.PlugIn.V8
TODO:
*
* locales
Add *customXX locale keys in RAVEN for each v7 comparable object that is custom text able so can properly do localized text
but, figure out where they are stored in v7 because the export isn't bombing so where are they going or coming from?
* todo locales for custom fields fixup - needs objects keys at destination first.
* todo: once have moved beyond what's in the v8 import stuff then need to remove all that, though maybe comment out some bits as some may be useful for import / export??
*
* TODO: User, fixup translationID, headofficeid, clientid vendorid, phone1, phone2, pagermaxtext
* todo: make up stub versions of all the core biz objects so can test a full wiki, attachment etc import
todo: export docs, settle on "Export" and edit all references to Import to switch it around as it's probably confusing artifact from dbdump days
* TODO: User: headofficeid, clientid vendorid, phone1, phone2, pagermaxtext
*
*
*
@@ -248,7 +251,7 @@ namespace AyaNova.PlugIn.V8
if (progress.KeepGoing)
await ExportUsers(progress);
@@ -451,8 +454,7 @@ namespace AyaNova.PlugIn.V8
await util.EventLog(3, newId, creator, modifier, c.Created, c.Modified);
}
//todo fixup post import
progress.Append("TODO: User, fixup translationID, headofficeid, clientid vendorid, phone1, phone2, pagermaxtext");
}
#endregion clients
@@ -523,18 +525,23 @@ namespace AyaNova.PlugIn.V8
LocaleMap.Add("Español", x);
break;
}
//MAKE A DUPLICATE
//name like this: "My custom (Espanol)" etc one for each target stock language
var exportName = i.Locale + " (" + RavenLocaleName + ")";
progress.SubOp("");
progress.Op("Exporting " + i.Locale + " to " + exportName);
var t = new util.NameIdItem { Name = exportName, Id = x };
a = await util.PostAsync("Translation/Duplicate", JObject.FromObject(t).ToString());
var targetTranslationId = util.IdFromResponse(a);
var ctoken = util.CTokenFromResponse(a);
//add to maps so can set user to it on export
LocaleMap.Add(i.Locale, targetTranslationId);
//going to default to the English based one because
//that's the majority of the users
if (RavenLocaleName == "en")
LocaleMap.Add(i.Locale, targetTranslationId);
//Ok, have our target locale created, not we need to insert our custom translations one by one
var trans = ((JArray)a.ObjectResponse["data"]["translationItems"]).ToObject<List<TranslationItem>>();
@@ -562,12 +569,12 @@ namespace AyaNova.PlugIn.V8
Id = v8TransItem.Id,
ConcurrencyToken = v8TransItem.ConcurrencyToken,
NewText = v7item.Value
});
});
}
//update it
progress.SubOp("Posting translation "+ exportName +" to server ");
progress.SubOp("Posting translation " + exportName + " to server ");
await util.PutAsync("Translation/UpdateTranslationItemsDisplayText",
JArray.FromObject(exportItems).ToString());
@@ -578,7 +585,7 @@ namespace AyaNova.PlugIn.V8
progress.SubOp("");
}
#region locale utility
public class TranslationItem
{
@@ -619,7 +626,7 @@ namespace AyaNova.PlugIn.V8
case "O.WorkorderItemOutsideService":
case "O.WorkorderService.CloseByDate":
case "UI.Label.CurrentUserName":
case "UI.Go.Search":
case "UI.Go.Search":
return "**SKIP**";
}
@@ -897,8 +904,8 @@ namespace AyaNova.PlugIn.V8
if (f.Visible)
{
int n = Convert.ToInt32(f.FieldName.Replace("Custom", "")) + 1;//raven custom fields are 1 based, v7 are zero based
CustomFieldLocaleKeys.Add(RavenCustomTranslationKeyObjectName + n.ToString(),
util.LocaleText.GetLocalizedText(v7CustomFieldObjectName + ".Label." + f.FieldName));
//CustomFieldLocaleKeys.Add(RavenCustomTranslationKeyObjectName + n.ToString(),
// util.LocaleText.GetLocalizedText(v7CustomFieldObjectName + ".Label." + f.FieldName));
dynamic dt = new JObject();
dt.fld = RavenCustomTranslationKeyObjectName + "Custom" + n.ToString();