From d129192c9fdc63fe78f4db835334e82bbf8aed60 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 15 Mar 2022 21:27:20 +0000 Subject: [PATCH] --- docs/8.0/ayanova/docs/adm-license.md | 3 ++- docs/8.0/ayanova/docs/ay-evaluate.md | 10 ++++++++++ docs/8.0/ayanova/docs/ops-import-v7.md | 8 +++++++- docs/8.0/ayanova/docs/ops-restore.md | 12 +++--------- server/AyaNova/biz/PrimeData.cs | 2 +- server/AyaNova/biz/ReportBiz.cs | 15 ++++++++++++--- server/AyaNova/util/DbUtil.cs | 3 +++ 7 files changed, 38 insertions(+), 15 deletions(-) diff --git a/docs/8.0/ayanova/docs/adm-license.md b/docs/8.0/ayanova/docs/adm-license.md index 190515d7..0c4f9767 100644 --- a/docs/8.0/ayanova/docs/adm-license.md +++ b/docs/8.0/ayanova/docs/adm-license.md @@ -144,7 +144,8 @@ Everything is erased **except** the following items: - Operations backup settings - Operations notification settings - Business logos -- Reports +- Reports (any missing stock report templates will be re-installed) +- Tax codes These items are kept as this feature is typically used when people are evaluating AyaNova and are ready to start using it for real but want to keep the non business data settings and reports to save having to re-enter them again. diff --git a/docs/8.0/ayanova/docs/ay-evaluate.md b/docs/8.0/ayanova/docs/ay-evaluate.md index 7188297c..7eb1b0fc 100644 --- a/docs/8.0/ayanova/docs/ay-evaluate.md +++ b/docs/8.0/ayanova/docs/ay-evaluate.md @@ -24,6 +24,16 @@ If this is your first time starting AyaNova and it has no database set up yet, t The _Generate sample data_ button in the evaluate page opens a dialog to select the quantity of sample data you wish to generate and set the time zone desired for the sample data to be generated within. +### Database will be erased + +Seeding will trigger erasure of **all** data in AyaNova in order to return it to a clean state with the following exceptions. + +- Global settings +- Operations backup settings +- Operations notification settings +- Business logos +- Reports (any missing stock report templates will be re-installed) + ### Seed level This setting controls the amount of data generated. The options are small, medium, large and huge. Each option will generate progressively _more_ data than the last. The actual types of data generated are the same, only the quantity differs. diff --git a/docs/8.0/ayanova/docs/ops-import-v7.md b/docs/8.0/ayanova/docs/ops-import-v7.md index e556f4f7..83d501cf 100644 --- a/docs/8.0/ayanova/docs/ops-import-v7.md +++ b/docs/8.0/ayanova/docs/ops-import-v7.md @@ -42,7 +42,13 @@ Be sure to have all staff carefully test all business processes they require in ### AyaNova 8 database will be erased -The V8Migrate plugin will erase all data including attached files in the AyaNova 8 database as the first step. +The V8Migrate plugin will erase **all** user entered data including attached files in the AyaNova 8 database as the first step with the following exceptions: + +- Global settings +- Operations backup settings +- Operations notification settings +- Business logos +- Reports (any missing stock report templates will be re-installed) There is no ability to synchronize or partially migrate only recent changes from v7; the migrate process entirely replaces the V8 data each time it's run. diff --git a/docs/8.0/ayanova/docs/ops-restore.md b/docs/8.0/ayanova/docs/ops-restore.md index 79cb979a..0039e3f2 100644 --- a/docs/8.0/ayanova/docs/ops-restore.md +++ b/docs/8.0/ayanova/docs/ops-restore.md @@ -60,17 +60,11 @@ The location of these folders is also logged on server startup in the [server lo ### Restore the attachments -1. Identify the attachments data folder location +1. Identify the attachments data folder location. Check the [server configuration](ops-config-environment-variables.md) and identify the location of the attachment files. There are two ways this can be specified, either directly through the [AYANOVA_ATTACHMENT_FILES_PATH](ops-config-folder-user-files.md) setting or indirectly through the [AYANOVA_DATA_PATH](ops-config-data-path.md) setting in which case the attachments folder will be found in a folder called `attachments` inside the folder specified by the AYANOVA_DATA_PATH setting. - Check the [server configuration](ops-config-environment-variables.md) and identify the location of the attachment files. There are two ways this can be specified, either directly through the [AYANOVA_ATTACHMENT_FILES_PATH](ops-config-folder-user-files.md) setting or indirectly through the [AYANOVA_DATA_PATH](ops-config-data-path.md) setting in which case the attachments folder will be found in a folder called `attachments` inside the folder specified by the AYANOVA_DATA_PATH setting. +2. Erase the current contents of the attachments folder identifed above, it must be completely empty before the next step. Note: you do not need to erase any other folders that may also be in the data folder such as logs, backup or temp, only the attachments folder contents need to be erased -2. Erase the current contents of the attachments folder identifed above, it must be completely empty before the next step - - Note: you do not need to erase any other folders that may also be in the data folder such as logs, backup or temp, only the attachments folder contents need to be erased - -3. Unzip the contents of the attachments zip file into the attachments folder. - - There will be a lot of folders with single letter of digit names contained within each other, this is normal, you will not see recognizable file names here. Be careful to ensure you are unzipping _into_ the attachments folder and not a sub folder, it's easy to accidentally unzip a higher level directory into the intended directory in which case you won't see any of your attachments in AyaNova until this is resolved. +3. Unzip the contents of the attachments zip file into the attachments folder. There will be a lot of folders with single letter of digit names contained within each other, this is normal, you will not see recognizable file names here. Be careful to ensure you are unzipping _into_ the attachments folder and not a sub folder, it's easy to accidentally unzip a higher level directory into the intended directory in which case you won't see any of your attachments in AyaNova until this is resolved. ### Restore the database diff --git a/server/AyaNova/biz/PrimeData.cs b/server/AyaNova/biz/PrimeData.cs index cf17eece..d3b3ac22 100644 --- a/server/AyaNova/biz/PrimeData.cs +++ b/server/AyaNova/biz/PrimeData.cs @@ -136,7 +136,7 @@ namespace AyaNova.Biz foreach (FileInfo file in di.EnumerateFiles()) { if (file.Extension.ToLowerInvariant() == ".ayrt") - await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName))); + await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName)), true); } } } diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index 218377e6..eaf3ef6e 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -63,7 +63,7 @@ namespace AyaNova.Biz //////////////////////////////////////////////////////////////////////////////////////////////// //IMPORT // - internal async Task ImportAsync(JObject o) + internal async Task ImportAsync(JObject o, bool skipIfAlreadyPresent = false) { //Report newObject = new Report(); @@ -78,7 +78,16 @@ namespace AyaNova.Biz { NotUnique = await ct.Report.AnyAsync(z => z.Name == newUniqueName); if (NotUnique) - newUniqueName = Util.StringUtil.UniqueNameBuilder(proposedName, l++, 255); + { + if (!skipIfAlreadyPresent) + newUniqueName = Util.StringUtil.UniqueNameBuilder(proposedName, l++, 255); + else + { + ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger(); + log.LogInformation($"Import report '{proposedName}' skipped due to already present in database."); + return true; + } + } } while (NotUnique); @@ -186,7 +195,7 @@ namespace AyaNova.Biz //GET LIST // internal async Task> GetReportListAsync(AyaType aType) - { + { var rpts = await ct.Report.AsNoTracking().Where(z => z.AType == aType && z.Active == true).Select(z => new { id = z.Id, name = z.Name, roles = z.Roles }).OrderBy(z => z.name).ToListAsync(); var ret = new List(); foreach (var item in rpts) diff --git a/server/AyaNova/util/DbUtil.cs b/server/AyaNova/util/DbUtil.cs index 64932c34..fcb19ea0 100644 --- a/server/AyaNova/util/DbUtil.cs +++ b/server/AyaNova/util/DbUtil.cs @@ -568,6 +568,9 @@ namespace AyaNova.Util //If we got here then it's safe to erase the attachment files FileUtil.EraseEntireContentsOfAttachmentFilesFolder(); + _log.LogInformation("Importing any missing stock Report templates"); + await AyaNova.Biz.PrimeData.PrimeReportTemplates(); + apiServerState.ResumePriorState(); _log.LogInformation("Database erase completed");