diff --git a/.vscode/launch.json b/.vscode/launch.json index 54300f43..6f3fd776 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -63,7 +63,7 @@ "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;CommandTimeout=300;", "AYANOVA_DATA_PATH": "c:\\temp\\ravendata", "AYANOVA_USE_URLS": "http://*:7575;", - "AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", + //"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", //"AYANOVA_REMOVE_LICENSE_FROM_DB":"true", //"AYANOVA_REPORT_RENDERING_TIMEOUT":"1", //"AYANOVA_REPORT_RENDER_API_URL_OVERRIDE": "http://localhost:7575", diff --git a/server/AyaNova/Controllers/GlobalBizSettingsController.cs b/server/AyaNova/Controllers/GlobalBizSettingsController.cs index 3b94835c..6bb5ac47 100644 --- a/server/AyaNova/Controllers/GlobalBizSettingsController.cs +++ b/server/AyaNova/Controllers/GlobalBizSettingsController.cs @@ -142,7 +142,8 @@ namespace AyaNova.Api.Controllers //used to drive UI in case of out of date release message to be shown to staff users non subscription only ShowUpdateAvailable = (Util.AyaNovaVersion.VersionString != AyaNova.Util.ServerGlobalOpsSettingsCache.LATEST_VERSION && !IsSubscriptionBuild), LatestVersion = AyaNova.Util.ServerGlobalOpsSettingsCache.LATEST_VERSION, - ChangeLogUrl = AyaNova.Util.ServerGlobalOpsSettingsCache.CHANGE_LOG_URL + ChangeLogUrl = AyaNova.Util.ServerGlobalOpsSettingsCache.CHANGE_LOG_URL, + LicenseExpirationDays = AyaNova.Core.License.ActiveKey.LicenseExpirationDays // , // TestTSDaysWMS=new TimeSpan(22,10,15,22,33), diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 08de42aa..abd0edd0 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -20,7 +20,7 @@ namespace AyaNova.Util /////////// CHANGE THIS ON NEW SCHEMA UPDATE //////////////////// //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! - private const int DESIRED_SCHEMA_LEVEL = 17; + private const int DESIRED_SCHEMA_LEVEL = 18; internal const long EXPECTED_COLUMN_COUNT = 1389; internal const long EXPECTED_INDEX_COUNT = 160; @@ -1799,7 +1799,7 @@ CREATE OR REPLACE VIEW public.viewpartinventorylist } - ////////////////////////////////////////////////// + ////////////////////////////////////////////////// // // case 4491 // @@ -1807,7 +1807,7 @@ CREATE OR REPLACE VIEW public.viewpartinventorylist { LogUpdateMessage(log); - + //english translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'ServerUpdateAvailable', 'New version available' FROM atranslation t where t.baselanguage = 'en'"); @@ -1825,6 +1825,31 @@ CREATE OR REPLACE VIEW public.viewpartinventorylist } + ////////////////////////////////////////////////// + // + // case 4522 + // + if (currentSchema < 18) + { + LogUpdateMessage(log); + + //english translations + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseExpirationDays', 'Days before license expires' FROM atranslation t where t.baselanguage = 'en'"); + + //spanish translations + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseExpirationDays', 'Días antes de que caduque la licencia' FROM atranslation t where t.baselanguage = 'es'"); + + //french translations + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseExpirationDays', 'Jours avant l''expiration de la licence' FROM atranslation t where t.baselanguage = 'fr'"); + + //german translations + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseExpirationDays', 'Tage vor Ablauf der Lizenz' FROM atranslation t where t.baselanguage = 'de'"); + + await SetSchemaLevelAsync(++currentSchema); + + } + + //######################################### diff --git a/server/AyaNova/util/License.cs b/server/AyaNova/util/License.cs index 25434d41..7b8cf232 100644 --- a/server/AyaNova/util/License.cs +++ b/server/AyaNova/util/License.cs @@ -271,6 +271,16 @@ namespace AyaNova.Core } + public int LicenseExpirationDays + { + get + { + if (WillExpire) + return (int)(LicenseExpiration.ToUniversalTime() - DateTime.UtcNow).TotalDays; + else + return -1;//not expiring + } + } public string LicenseFormat { get; set; } public string Id { get; set; }