diff --git a/AyaNovaQBI/MainForm.Designer.cs b/AyaNovaQBI/MainForm.Designer.cs index bd1ed69..00f2590 100644 --- a/AyaNovaQBI/MainForm.Designer.cs +++ b/AyaNovaQBI/MainForm.Designer.cs @@ -171,19 +171,19 @@ // this.onlineManualToolStripMenuItem.Name = "onlineManualToolStripMenuItem"; this.onlineManualToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1; - this.onlineManualToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.onlineManualToolStripMenuItem.Size = new System.Drawing.Size(171, 22); this.onlineManualToolStripMenuItem.Text = "&Online manual"; // // technicalsupportToolStripMenuItem // this.technicalsupportToolStripMenuItem.Name = "technicalsupportToolStripMenuItem"; - this.technicalsupportToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.technicalsupportToolStripMenuItem.Size = new System.Drawing.Size(171, 22); this.technicalsupportToolStripMenuItem.Text = "Technical &support"; // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(171, 22); this.aboutToolStripMenuItem.Text = "&About"; // // exitToolStripMenuItem diff --git a/AyaNovaQBI/MainForm.cs b/AyaNovaQBI/MainForm.cs index ea91164..7bf48a2 100644 --- a/AyaNovaQBI/MainForm.cs +++ b/AyaNovaQBI/MainForm.cs @@ -21,12 +21,15 @@ namespace AyaNovaQBI { //Initialize - if(await util.InitializeQBI() == false) + StringBuilder initErrors = new StringBuilder(); + if (await util.InitializeQBI(initErrors) == false) { + if (initErrors.Length>0) + await Task.Run(() => MessageBox.Show($"AyaNova QBI was unable to start:\r\n{initErrors.ToString()}")); Close(); } - -// grid.DataSource = util.GetInvoiceableItems(); + + // grid.DataSource = util.GetInvoiceableItems(); } private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) @@ -39,7 +42,8 @@ namespace AyaNovaQBI if (!isLinked) { grid.Rows[e.RowIndex].ErrorText = "Not invoiceable: use \"Invoice\" -> \"Fix problems\" to resolve"; - }else + } + else { grid.Rows[e.RowIndex].ErrorText = null; } diff --git a/AyaNovaQBI/auth.cs b/AyaNovaQBI/auth.cs index 71ed7ba..fb9eead 100644 --- a/AyaNovaQBI/auth.cs +++ b/AyaNovaQBI/auth.cs @@ -72,11 +72,11 @@ namespace AyaNovaQBI return; } - MessageBox.Show($@"TEST - LOGIN SUCCEEDED: \r\ -AyaNovaUserName: {util.AyaNovaUserName}\r\n -JWT: {util.JWT}\r\n -AyaNovaUserRoles: {util.AyaNovaUserRoles}\r\n -AyaNovaUserType: {util.AyaNovaUserType}"); +// MessageBox.Show($@"TEST - LOGIN SUCCEEDED: \r\ +//AyaNovaUserName: {util.AyaNovaUserName}\r\n +//JWT: {util.JWT}\r\n +//AyaNovaUserRoles: {util.AyaNovaUserRoles}\r\n +//AyaNovaUserType: {util.AyaNovaUserType}"); btnLogin.Enabled = btnTest.Enabled = true; diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index c0ae4e0..34ffa4c 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -449,7 +449,7 @@ namespace AyaNovaQBI } - public static async Task InitializeQBI() + public static async Task InitializeQBI(StringBuilder initErrors) { //COPY most of this code from qbi v7 becuase it has a lot of edge cases in it and it's complex and thorough, but break it into abstracted bits so can be replicated in other accounting add-on's more easily @@ -459,11 +459,14 @@ namespace AyaNovaQBI if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) return false; - //Fetch AyaNova license - var r=await GetAsync("license"); - todo: need to be able to check via route if has licensefeature, code is already in license biz object, just need exposed to route for logged in users only under license/has-feature - //Check if licensed + var r = await GetAsync("license/has-feature/XQBI"); + if (!r.ObjectResponse["data"].Value()) + { + initErrors.AppendLine("This AyaNova server is not licensed to use QBI"); + return false; + } + //check if build date is within licensed date (how did I do that automated build date thing?) // copy timestamp.cs and the createtimestamp.exe utility from v7 qbi and create build event to run it here and do same thing //check that AyaNova version matches required minimum for this QBI (