This commit is contained in:
2021-01-23 01:38:20 +00:00
parent f1698fe8b8
commit 96bf51ded7
3 changed files with 23 additions and 38 deletions

View File

@@ -5,6 +5,11 @@
MISC ITEMS THAT CAME UP
todo: GetErrorBoxErrors is not translating due to async / sync mix.
proposal is to make a seperate async method for general error box errors or translate earlier in the actual fetch api method call return when error found
todo: every form all fields error collection is set to "servererrors" but really its' any kind of validation error local or server so not sure why ti's named that
todo: *biz objects with foreign key constraints should call ValidateCanDelete
and validatecandelete *MUST* check for those constraints and return a proper error object
Note: this must happen independently for EACH reference so check each referencing table one by one and add an error for each to send back to user
@@ -156,7 +161,20 @@ todo: server boot up message should show the port it's listening on if possible
CURRENTLY DOING: PartByWarehouseInventory part stock taking view and list
CURRENTLY DOING: Cleanup with untranslated error string when attempting to delete a linked warehouse
Have fixed it with some code at server, see partwarehouse ValidateCanDelete code.
so now that's working, clean it up
Remove translation await code from gzform as it's not going to work that way and assume all errors come with pre-translated or do not require a fetch
all stock error number validation codes errors should nto need to fetch as be prefetched so no need for async for that particualr purpose
At server add standard *biz function to Translate(key) to replace the long winded one in ValidateCanDelete that is available to *all* biz objects
Then go into every validate save and validate delete and look for lt keys and replace with this pre-translate call to Translate(key)
Finally the error display for a referential integrity error on delete is ugly, confusing and has too much shit going on
clean it up to a one liner that clearly mixes in the object name with the error however that has to happen.
just want to see a clean list of all the types of objects it's linked to
PartByWarehouseInventory part stock taking view and list
todo: make the adjustments list item the partinventorytransactions list
todo: make the partinventory just be the partinventory reconcilliation stock taking thing

View File

@@ -518,6 +518,7 @@ export default {
that.statusEx(r);
//delete will return a body if there is an error of some kind with the request
r = await that.extractBodyEx(r);
return r;
} catch (error) {
//fundamental error, can't proceed with this call

View File

@@ -588,40 +588,6 @@ export default {
// 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
// if (vm.$ay.dev) {
// //make sure formState.serverErrors is defined on data
// if (!window.$gz.util.has(vm, "formState.serverError")) {
// throw new Error(
// "DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object"
// );
// }
// //make sure formState.appError is defined on data
// if (!window.$gz.util.has(vm, "formState.appError")) {
// throw new Error(
// "DEV ERROR gzform::formState.serverErrors -> formState.appError seems to be missing from form's vue data object"
// );
// }
// //make sure formState.errorBoxMessage is defined on data
// if (!window.$gz.util.has(vm, "formState.errorBoxMessage")) {
// throw new Error(
// "DEV ERROR gzform::formState.serverErrors -> formState.errorBoxMessage seems to be missing from form's vue data object"
// );
// }
// //ensure the error returned is in an expected format to catch coding errors at the server end
// if (!window.$gz.util.objectIsEmpty(vm.formState.serverError)) {
// //de-lodash with my own function
// //Make sure there is an error code if there is an error collection
// if (!vm.formState.serverError.code) {
// throw new Error(
// "DEV ERROR gzform::formState.serverErrors -> server returned error without code"
// );
// }
// }
// }
let ret = [];
//check for errors if we have any errors
@@ -688,14 +654,14 @@ export default {
ve.error +
"]";
if (ve.message) {
//NOTE: This is how to handle calling an async function from a sync function
//NOTE: This is (**still not**) how to handle calling an async function from a sync function
//for reference sync async function async method from sync method
//it just can't be done and this needs to go away and not be expected to do this
let transMessage = ve.message;
window.$gz.translation
.translateStringWithMultipleKeys(ve.message)
.then(result => {
transMessage = result;
console.log("Got Translation");
});
fldErr += ' - "' + transMessage + '"';
ret.push(fldErr);
@@ -709,7 +675,7 @@ export default {
vm: vm,
valid: false
});
console.log("done - Returning");
return ret;
}
}