This commit is contained in:
2022-06-22 20:22:10 +00:00
parent a06c204036
commit e140a9cf5b
2 changed files with 24 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ namespace AyaNovaQBI
/// <remarks> /// <remarks>
/// Do not modify the definition of BuildAt as your changes will be discarded. /// Do not modify the definition of BuildAt as your changes will be discarded.
/// </remarks> /// </remarks>
public static DateTime BuildAt { get { return new DateTime(637914972292295086); } } //--** public static DateTime BuildAt { get { return new DateTime(637914996753521669); } } //--**
/// <summary> /// <summary>
/// The program that time stamped it. /// The program that time stamped it.
/// </summary> /// </summary>

View File

@@ -474,6 +474,14 @@ namespace AyaNovaQBI
if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
return false; return false;
//CHECK ROLE
//must have Accounting full role to use QBI
if (!AyaNovaUserRoles.HasFlag(AuthorizationRoles.Accounting))
{
initErrors.AppendLine($"User must have the \"Accounting\" Role to use QBI\r\n");
return false;
}
//Get license //Get license
var r = await GetAsync("license"); var r = await GetAsync("license");
ALicense = r.ObjectResponse["data"]["license"].ToObject<AyaNovaLicense>(); ALicense = r.ObjectResponse["data"]["license"].ToObject<AyaNovaLicense>();
@@ -493,7 +501,7 @@ namespace AyaNovaQBI
} }
//check if build date is within maintenance and updates expiry date //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 " + initErrors.AppendLine("NOT LICENSED!\r\n\r\nThis QBI plugin was built " +
@@ -504,8 +512,6 @@ namespace AyaNovaQBI
return false; return false;
} }
// 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 (
//PFC - Util.QBValidate stuff: //PFC - Util.QBValidate stuff:
//Validate QB connection can be made and open connection and start session with QB (see Util.QBValidate in v7 //Validate QB connection can be made and open connection and start session with QB (see Util.QBValidate in v7
@@ -515,6 +521,9 @@ namespace AyaNovaQBI
//PFC - PopulateQBListCache() //PFC - PopulateQBListCache()
//PFC - PopulateAyaListCache() //PFC - PopulateAyaListCache()
//PFC - integration object check (fetch or create if not present) (Util.integrationObjectCheck()) //PFC - integration object check (fetch or create if not present) (Util.integrationObjectCheck())
if (!await IntegrationCheck(initErrors))
return false;
//NOTE: probably can make a class for this and use newtonsoft to convert dynamic returned from api call to class object? //NOTE: probably can make a class for this and use newtonsoft to convert dynamic returned from api call to class object?
//PFC - Validate settings, create if necessary (Util.ValidateSettings()) and save //PFC - Validate settings, create if necessary (Util.ValidateSettings()) and save
//PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199) //PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199)
@@ -526,6 +535,15 @@ namespace AyaNovaQBI
} }
public static async Task<bool> IntegrationCheck(StringBuilder initErrors)
{
//Check for integration object at server, if not there then create one if have sufficient rights
//check if inactive
await Task.CompletedTask;
return true;
}
#endregion #endregion