diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index f9f3bf85..cea61403 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -490,6 +490,8 @@ export default { /////////////////////////////// // SERVER ERRORS // Process and return server errors if any for form and field specified + // note that this is called in turn by every control on the form so it's only job + // is to return errors if they exist for *that* field // serverErrors(vm, ref) { //CHECK PREREQUISITES IN DEV MODE TO ENSURE FORM ISN"T MISSING NEEDED DATA ATTRIBUTES ETC @@ -545,8 +547,9 @@ export default { //GENERAL ERROR if (ref == "errorbox") { - //Add any general errors to ret + //Add any general errors to ret (specific detail errors for the errorbox will be processed later below) let err = vm.$ay.t("ErrorAPI" + apiErrorCode.toString()); + if (vm.formState.serverError.message) { err = err + "\r\n" + vm.formState.serverError.message; } @@ -558,13 +561,13 @@ export default { }); ret.push(err); } + //DETAIL ERRORS //{"error":{"code":"2200","details":[{"message":"Exception: Error converting value \"\" to type 'AyaNova.Biz.AUTHORIZATION_ROLES'. Path 'roles', line 1, position 141.","target":"roles","error":"2203"}],"message":"Object did not pass validation"}} //Specific field validation errors are in an array in "details" key if (!window.$gz._.isEmpty(vm.formState.serverError.details)) { //See if this key is in the details array let errorsForField = getErrorsForField(vm, ref); - if (errorsForField.length > 0) { //iterate the errorsForField object and add each to return array of errors window.$gz._.each(errorsForField, function(ve) { @@ -576,6 +579,9 @@ export default { ve.error + "]"; if (ve.message) { + if (ve.message.includes("LT:")) { + ve.message = vm.$ay.t(ve.message.split(":")[1]); + } fldErr += ' - "' + ve.message + '"'; } ret.push(fldErr); diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index 115fa742..aeaec790 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -145,6 +145,8 @@ export default { "ErrorUserNotAuthorized", "ErrorNoMatch", "ErrorPickListQueryInvalid", + "ErrorSecurityUserCapacity", + "ErrorDBForeignKeyViolation", "DeletePrompt", "AreYouSureUnsavedChanges", "Leave",