This commit is contained in:
@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
public string PluginVersion
|
||||
{
|
||||
get { return "7.6.1-alpha.101"; }
|
||||
get { return "7.6.1-alpha.104"; }
|
||||
}
|
||||
|
||||
public string About
|
||||
@@ -419,6 +419,32 @@ namespace AyaNova.PlugIn.V8
|
||||
UsedNames.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<string> UsedUserNames = new List<string>();
|
||||
long LUniqueUserName = 1;
|
||||
private string GetUniqueUserName(string tryName)
|
||||
{
|
||||
|
||||
string retName = tryName;
|
||||
do
|
||||
{
|
||||
if (!UsedUserNames.Contains(retName))
|
||||
{
|
||||
UsedUserNames.Add(retName);
|
||||
return retName;
|
||||
}
|
||||
retName = util.UniqueNameBuilder(tryName, LUniqueUserName++, 255);
|
||||
} while (true);
|
||||
|
||||
}
|
||||
|
||||
private void ResetUniqueUserNames()
|
||||
{
|
||||
LUniqueUserName = 1;
|
||||
UsedUserNames.Clear();
|
||||
}
|
||||
|
||||
#region Users
|
||||
|
||||
private async System.Threading.Tasks.Task ExportStaffUsers(ProgressForm progress)
|
||||
@@ -501,7 +527,7 @@ namespace AyaNova.PlugIn.V8
|
||||
var ObjectTID = new TypeAndID(RootObjectTypes.User, c.ID);
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = GetUniqueName(c.FirstName + " " + c.LastName);
|
||||
d.name = GetUniqueUserName(c.FirstName + " " + c.LastName);
|
||||
if (IsDuplicatev7v8IdMapItem(c.ID, c.FirstName + " " + c.LastName, progress)) continue;
|
||||
progress.Op("User " + d.name);
|
||||
//throw new System.Exception("TODO: UserTypes sb done differently now to align");
|
||||
@@ -660,7 +686,7 @@ namespace AyaNova.PlugIn.V8
|
||||
var ObjectTID = new TypeAndID(RootObjectTypes.User, c.ID);
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = GetUniqueName(c.FirstName + " " + c.LastName);
|
||||
d.name = GetUniqueUserName(c.FirstName + " " + c.LastName);
|
||||
if (IsDuplicatev7v8IdMapItem(c.ID, c.FirstName + " " + c.LastName, progress)) continue;
|
||||
progress.Op("User " + d.name);
|
||||
//throw new System.Exception("TODO: UserTypes sb done differently now to align");
|
||||
@@ -971,7 +997,7 @@ namespace AyaNova.PlugIn.V8
|
||||
//--------------------------------
|
||||
|
||||
d = new JObject();
|
||||
d.name = GetUniqueName(c.Contact);
|
||||
d.name = GetUniqueUserName(c.Contact);
|
||||
|
||||
progress.Op("Contact " + d.name);
|
||||
d.userType = RavenUserType.Customer;
|
||||
@@ -1181,7 +1207,7 @@ namespace AyaNova.PlugIn.V8
|
||||
//--------------------------------
|
||||
|
||||
d = new JObject();
|
||||
d.name = GetUniqueName(c.Contact);
|
||||
d.name = GetUniqueUserName(c.Contact);
|
||||
|
||||
progress.Op("Contact " + d.name);
|
||||
d.userType = RavenUserType.HeadOffice;
|
||||
@@ -1405,7 +1431,7 @@ namespace AyaNova.PlugIn.V8
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
||||
|
||||
//cache unit of measures
|
||||
UnitOfMeasurePickList umpl=UnitOfMeasurePickList.GetList(false);
|
||||
UnitOfMeasurePickList umpl = UnitOfMeasurePickList.GetList(false);
|
||||
|
||||
foreach (PartPickList.PartPickListInfo i in pl)
|
||||
{
|
||||
@@ -1420,7 +1446,8 @@ namespace AyaNova.PlugIn.V8
|
||||
if (IsDuplicatev7v8IdMapItem(c.ID, c.PartNumber, progress)) continue;
|
||||
progress.Op(ObjectTypeName + " " + d.partNumber + " " + d.name);
|
||||
d.name = c.Name;
|
||||
d.partNumber = c.PartNumber;
|
||||
|
||||
d.partNumber = GetUniqueName(c.PartNumber);
|
||||
d.manufacturerId = Getv7v8IdMapNullOk(c.ManufacturerID);
|
||||
d.manufacturerNumber = c.ManufacturerNumber;
|
||||
d.wholeSalerId = Getv7v8IdMapNullOk(c.WholesalerID);
|
||||
@@ -1433,7 +1460,7 @@ namespace AyaNova.PlugIn.V8
|
||||
if (c.UnitOfMeasureID != Guid.Empty && umpl.Contains(c.UnitOfMeasureID))
|
||||
{
|
||||
d.unitOfMeasure = umpl[c.UnitOfMeasureID].Name;
|
||||
}
|
||||
}
|
||||
d.active = c.Active;
|
||||
d.notes = c.Notes;
|
||||
SetTags(d, tags);
|
||||
@@ -1781,6 +1808,9 @@ namespace AyaNova.PlugIn.V8
|
||||
PickListAutoComplete pl = PickListAutoComplete.GetList("**", "unitmodel");
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
||||
|
||||
//model number and vendorid must be unique
|
||||
List<string> UnqNumberVendorId = new List<string>();
|
||||
|
||||
foreach (PickListAutoComplete.PickListAutoCompleteInfo i in pl)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
@@ -1792,18 +1822,18 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
dynamic d = new JObject();
|
||||
|
||||
//neither name nor number are unique at either end by intention
|
||||
d.name = c.Name;
|
||||
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
if (string.IsNullOrWhiteSpace(c.ModelNumber))
|
||||
{
|
||||
d.number = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
d.number = c.ModelNumber;
|
||||
}
|
||||
string tempModelNumber = c.ModelNumber;
|
||||
if (string.IsNullOrWhiteSpace(tempModelNumber))
|
||||
tempModelNumber = "0";//was not required in v7, is required in v8
|
||||
|
||||
//UNIT MODEL NUMBER and VENDOR ID combo must be unique!!
|
||||
//this ensures that by appending a extra number character that is unique then removing the vendorid from the start
|
||||
//resulting in a unique name/vendorid combo
|
||||
d.number = GetUniqueName(c.VendorID.ToString() + tempModelNumber).Replace(c.VendorID.ToString(), "");
|
||||
|
||||
d.active = c.Active;
|
||||
d.notes = c.Notes;
|
||||
if (c.VendorID != Guid.Empty)
|
||||
@@ -2765,9 +2795,9 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale);
|
||||
progress.Op("Checking if locale " + i.Locale + " is customized");
|
||||
//#if(DEBUG)
|
||||
// continue;
|
||||
//#endif
|
||||
//#if(DEBUG)
|
||||
// continue;
|
||||
//#endif
|
||||
if (!util.LocaleIsCustomized(i.Locale, lt, progress)) continue;
|
||||
////calculate hash
|
||||
//List<string> allStrings = new List<string>();
|
||||
|
||||
@@ -165,7 +165,9 @@ namespace AyaNova.PlugIn.V8
|
||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception("POST error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase);
|
||||
if (string.IsNullOrWhiteSpace(postJson))
|
||||
postJson = "n/a";
|
||||
throw new Exception("POST error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase + "\nOBJECT:\n" + postJson);
|
||||
}
|
||||
else
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
@@ -244,8 +246,8 @@ namespace AyaNova.PlugIn.V8
|
||||
d.ayId = RavenId;
|
||||
d.creator = RavenCreatorId;
|
||||
d.modifier = RavenModifierId;
|
||||
d.created = DateToV8(sCreated,true);
|
||||
d.modified = DateToV8(sModified,true);
|
||||
d.created = DateToV8(sCreated, true);
|
||||
d.modified = DateToV8(sModified, true);
|
||||
|
||||
await PostAsync("event-log/v7", d.ToString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user