This commit is contained in:
@@ -564,15 +564,11 @@ namespace AyaNovaQBI
|
||||
await IntegrationLog($"PFC: QB Company name= {QCompanyName}, QB Country version={QCountry}, QBVersion={QVersion}, Companyfile={QCompanyFile}");
|
||||
await PopulateQBListCache();
|
||||
await PopulateAyaListCache();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(QBIntegration.IntegrationData) || QBIntegration.Items.Count == 0)
|
||||
return true;//nothing mapped or set to validate return to mainform for initial setup to be triggered
|
||||
|
||||
//PFC - verify integration mapped objects still exist in QB
|
||||
if (!await ValidateQuickBooksHasMappedItems(initErrors))
|
||||
return false;
|
||||
|
||||
//DONE
|
||||
await IntegrationLog("PFC: QBI initialized and ready for use");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -582,10 +578,6 @@ namespace AyaNovaQBI
|
||||
return false;
|
||||
}
|
||||
|
||||
await IntegrationLog("PFC: QBI initialized and ready for use");
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -608,6 +600,7 @@ namespace AyaNovaQBI
|
||||
QBIntegration.IntegrationAppId = QBI_INTEGRATION_ID;
|
||||
QBIntegration.Active = true;
|
||||
QBIntegration.Name = "QBI - QuickBooks Desktop integration";
|
||||
QBIntegration.IntegrationData = Newtonsoft.Json.JsonConvert.SerializeObject(new QBIIntegrationData());//default empty integration data object
|
||||
r = await PostAsync("integration", Newtonsoft.Json.JsonConvert.SerializeObject(QBIntegration));
|
||||
QBIntegration.Id = IdFromResponse(r);
|
||||
await IntegrationLog("AyaNova QBI Integration installed to AyaNova");
|
||||
@@ -618,6 +611,12 @@ namespace AyaNovaQBI
|
||||
r = await GetAsync($"integration/{QBI_INTEGRATION_ID}");
|
||||
QBIntegration = r.ObjectResponse["data"].ToObject<Integration>();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(QBIntegration.IntegrationData))
|
||||
{
|
||||
initErrors.AppendLine("QBI Integration data is empty which should not happen normally and indicates corruption of some kind with the QBI setttings data stored in AyaNova.\r\nThe QBI settings should be removed and re-created by deleting the QBI Integration object in AyaNova\r\nSee the Administration section -> Integrations -> QuickBooks Desktop integration record in AyaNova\r\nThis record should be deleted then restart QBI to start setup again and create a fresh QBI integration settings object in AyaNova");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!QBIntegration.Active)
|
||||
{
|
||||
initErrors.AppendLine("QBI Integration is currently deactivated and can not be used\r\nThis setting can be changed in AyaNova in the Administration section -> Integrations -> QuickBooks Desktop integration record\r\nSet to active and save to enable QBI");
|
||||
@@ -645,7 +644,7 @@ namespace AyaNovaQBI
|
||||
{
|
||||
//Missing links table:
|
||||
DataTable dtTemp = new DataTable();
|
||||
dtTemp.Columns.Add("MAPID", typeof(Guid));
|
||||
dtTemp.Columns.Add("MAPID", typeof(long));
|
||||
dtTemp.Columns.Add("Name", typeof(string));
|
||||
|
||||
bool present = true;
|
||||
@@ -694,7 +693,7 @@ namespace AyaNovaQBI
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
await IntegrationLog("PFC: User opted to remove all mappings after double warning.");
|
||||
QBIntegration.Items.Clear();
|
||||
QBIntegration.Items.Clear();
|
||||
//Exists, fetch it check if active then we're done here
|
||||
ApiResponse r = await PostAsync($"integration/{QBI_INTEGRATION_ID}", Newtonsoft.Json.JsonConvert.SerializeObject(QBIntegration));
|
||||
QBIntegration = r.ObjectResponse["data"].ToObject<Integration>();
|
||||
|
||||
Reference in New Issue
Block a user