From 4b196e05cbadcf20c656b91d5ba0f2d5eebcdfdf Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 23 Jun 2022 00:47:29 +0000 Subject: [PATCH] --- AyaNovaQBI/Timestamp.cs | 2 +- AyaNovaQBI/util.cs | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/AyaNovaQBI/Timestamp.cs b/AyaNovaQBI/Timestamp.cs index 34a6ea0..f206003 100644 --- a/AyaNovaQBI/Timestamp.cs +++ b/AyaNovaQBI/Timestamp.cs @@ -22,7 +22,7 @@ namespace AyaNovaQBI /// /// Do not modify the definition of BuildAt as your changes will be discarded. /// - public static DateTime BuildAt { get { return new DateTime(637915141619134341); } } //--** + public static DateTime BuildAt { get { return new DateTime(637915168428123684); } } //--** /// /// The program that time stamped it. /// diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index 05c1deb..7688304 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -155,7 +155,7 @@ namespace AyaNovaQBI } else { - + if (a.ObjectResponse != null && a.ObjectResponse.ContainsKey("error")) { @@ -507,7 +507,7 @@ namespace AyaNovaQBI //BUILD DATE VERSION ALLOWED? - if(ALicense.maintenanceExpiration < Timestamp.BuildAt) + if (ALicense.maintenanceExpiration < Timestamp.BuildAt) { initErrors.AppendLine("NOT LICENSED!\r\n\r\nThis QBI plugin was built " + Timestamp.BuildAt.ToString("g") + "\r\n" + @@ -544,7 +544,7 @@ namespace AyaNovaQBI public static async Task IntegrationCheck(StringBuilder initErrors) { //Check for integration object at server, if not there then create one if have sufficient rights - //check if inactive + ApiResponse r = null; try { @@ -563,19 +563,22 @@ namespace AyaNovaQBI } else { - //Exists, fetch it and we're done here + //Exists, fetch it check if active then we're done here r = await GetAsync($"integration/{QBI_INTEGRATION_ID}"); QBIntegration = r.ObjectResponse["data"].ToObject(); + + 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"); + return false; + } } - // - - // - return true; - }catch(Exception ex) + } + catch (Exception ex) { initErrors.AppendLine("Error fetching QBI Integration object"); initErrors.AppendLine(ex.Message); @@ -585,8 +588,8 @@ namespace AyaNovaQBI } } - #endregion + #endregion - } + } }