diff --git a/docs/8.0/ayanova/docs/changelog.md b/docs/8.0/ayanova/docs/changelog.md index 24a632b4..213126cd 100644 --- a/docs/8.0/ayanova/docs/changelog.md +++ b/docs/8.0/ayanova/docs/changelog.md @@ -20,6 +20,7 @@ IN PROGRESS - Server: in some cases opening a record that has since been deleted (for example from an old link) gave a server error, and a report printed for records of which some had since been deleted failed; it now shows a "not found" message, and the report prints the remaining records. - Server: in some cases deleting a record that is still in use elsewhere (for example a customer, unit, part or rate used on a work order, quote or PM) gave a server error; it now always says which kind of record is using it. - Server: the server log now records the next automatic backup time (or that automatic backup is off) each time the server starts. +- Backup: the [number of backups to keep](ops-form-backup.md#number-of-backups-to-keep) can no longer be set below 1; a setting of 0 already kept the most recent backup, the same as 1. ### AyaNova 8.3.0 diff --git a/docs/8.0/ayanova/docs/ops-form-backup.md b/docs/8.0/ayanova/docs/ops-form-backup.md index 16f39890..3061bf52 100644 --- a/docs/8.0/ayanova/docs/ops-form-backup.md +++ b/docs/8.0/ayanova/docs/ops-form-backup.md @@ -158,7 +158,7 @@ Checking this box will cause AyaNova to also back up the attached files in addit _AyaNova Subscription service keeps one backup by default and this option is not available_ -The backup system will automatically remove old backups depending upon this setting. If it is set to 3 then the most recent three backups are kept. +The backup system will automatically remove old backups depending upon this setting. If it is set to 3 then the most recent three backups are kept. The minimum is 1: the most recent backup is always kept. If you are following the disaster recovery best practice policy of 10 backup rotation as [suggested above](#10-backup-rotation) then you would only need to keep 1 current backup set. diff --git a/server/AyaNova/Controllers/GlobalOpsBackupSettingsController.cs b/server/AyaNova/Controllers/GlobalOpsBackupSettingsController.cs index 72de8005..5c117508 100644 --- a/server/AyaNova/Controllers/GlobalOpsBackupSettingsController.cs +++ b/server/AyaNova/Controllers/GlobalOpsBackupSettingsController.cs @@ -79,9 +79,15 @@ namespace AyaNova.Api.Controllers GlobalOpsBackupSettingsBiz biz = GlobalOpsBackupSettingsBiz.GetBiz(ct, HttpContext); if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType)) return StatusCode(403, new ApiNotAuthorizedResponse()); - var o = await biz.PutAsync(updatedObject); + var o = await biz.PutAsync(updatedObject); if (o == null) - return StatusCode(409, new ApiErrorResponse(biz.Errors)); + { + //case 4763: the settings can now fail validation, which is not a concurrency conflict + if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT)) + return StatusCode(409, new ApiErrorResponse(biz.Errors)); + else + return BadRequest(new ApiErrorResponse(biz.Errors)); + } return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency })); } diff --git a/server/AyaNova/biz/GlobalOpsBackupSettingsBiz.cs b/server/AyaNova/biz/GlobalOpsBackupSettingsBiz.cs index 90b52200..499299c1 100644 --- a/server/AyaNova/biz/GlobalOpsBackupSettingsBiz.cs +++ b/server/AyaNova/biz/GlobalOpsBackupSettingsBiz.cs @@ -112,8 +112,12 @@ namespace AyaNova.Biz //Can save or update? private void Validate(GlobalOpsBackupSettings inObj) { - - //currently nothing to validate +#if (!SUBSCRIPTION_BUILD) + //case 4763: at least the newest backup is always kept, so fewer than 1 is not a setting (it was treated as 1) + //the subscription build always keeps 1 and its form doesn't show this setting + if (inObj.BackupSetsToKeep < 1) + AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "BackupSetsToKeep"); +#endif }