This commit is contained in:
2020-12-03 15:13:27 +00:00
parent c8e60e9f10
commit 4f3c9ab8c4

View File

@@ -1029,7 +1029,45 @@ namespace AyaNova.PlugIn.V8
progress.Op(ObjectTypeName + " " + d.name);
d.active = c.Active;
d.notes = c.Notes;
//No contact but has contact notes so append to general notes
if (!string.IsNullOrWhiteSpace(c.ContactNotes))
{
d.notes = c.Notes + "\nCONTACT NOTES:\n" + c.ContactNotes;
}
d.webAddress = c.WebAddress;
d.popUpNotes = c.PopUpNotes;
d.techNotes = c.TechNotes;
d.accountNumber = c.AccountNumber;
d.usesBanking = c.UsesBanking;
//TODO d.contractId =
d.contractExpires = c.ContractExpires;//?? dates
d.phone1 = c.Phone1;
d.phone2 = c.Phone2;
d.phone3 = c.Phone3;
d.phone4 = c.Phone4;
d.phone5 = c.Phone5;
d.emailAddress = c.Email;
d.postAddress = c.MailToAddress.DeliveryAddress;
d.postCity = c.MailToAddress.City;
d.postRegion = c.MailToAddress.StateProv;
d.postCode = c.MailToAddress.Postal;
d.address = c.GoToAddress.DeliveryAddress;
d.city = c.GoToAddress.City;
d.region = c.GoToAddress.StateProv;
d.country = c.GoToAddress.Country;
d.latitude = c.GoToAddress.Latitude;
d.longitude = c.GoToAddress.Longitude;
Tagit(c.RegionID, tags);
Tagit(c.DispatchZoneID, tags);
Tagit(c.ClientGroupID, tags);
SetTags(d, tags);
@@ -1074,6 +1112,52 @@ namespace AyaNova.PlugIn.V8
//Event log fixup
await util.EventLog(util.AyaType.HeadOffice, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
//RAVEN Contact type user from Client contact
//note: this is not a login account, it could be in raven but here it's the way to get the
//contact created
if (!string.IsNullOrWhiteSpace(c.Contact))
{
//create user here
//--------------------------------
d = new JObject();
d.name = GetUniqueName(c.Contact);
progress.Op("Contact " + d.name);
d.userType = RavenUserType.HeadOffice;
d.headOfficeId = RavenId;
d.active = false;//all imported users are inactive to start
d.roles = 0;//todo: try to determine role from v7 member of group? or is that even possible?
d.login = util.RandomString();
d.password = util.RandomString();
var rContact = await util.PostAsync("user", d.ToString());
long RavenContactId = util.IdFromResponse(rContact);
//USER OPTIONS
var rOptions = await util.GetAsync("user-option/" + RavenContactId.ToString());
d = rOptions.ObjectResponse["data"];
d.phone1 = c.Phone1;
d.phone2 = c.Phone2;
d.phone3 = c.Phone3;
d.emailAddress = c.Email;
// d.translationId = 1;
await util.PutAsync("user-option/" + RavenContactId.ToString(), d.ToString());
}
}
#endregion ho