This commit is contained in:
2021-01-25 15:16:57 +00:00
parent c9c58af971
commit 60cf87d3ea
8 changed files with 34 additions and 50 deletions

View File

@@ -168,43 +168,9 @@ CURRENTLY DOING: Cleanup with untranslated error string when attempting to dele
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
How it would look with ErrorDBForeignKeyViolation method:
---
Validation error
ErrorAPI2200
Invalid operation [2030] - "This object can not be deleted because it is linked to one or more related objects: Inventory transaction"
Invalid operation [2030] - "This object can not be deleted because it is linked to one or more related objects: Part"
Invalid operation [2030] - "This object can not be deleted because it is linked to one or more related objects: Unit"
Invalid operation [2030] - "This object can not be deleted because it is linked to one or more related objects: User"
---
Validation error
ErrorAPI2200
This object is linked to others and can not be changed this way [2208] - "Part"
This object is linked to others and can not be changed this way [2208] - "Unit"
This object is linked to others and can not be changed this way [2208] - "Inventory transaction"
This object is linked to others and can not be changed this way [2208] - "User"
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
EDIT form for partinventory item openobjecthyandler should open up to event log history of entry, not entry form since it is not editable anyway
todo: LT:NoType
modify datagrid to handle LT: in text fields (needs to cache values it finds)

View File

@@ -19,7 +19,7 @@ async function dealWithError(msg, vm) {
lastMessageTimeStamp = new Date();
//translate as necessary
msg = await window.$gz.translation.translateStringWithMultipleKeys(msg);
msg = await window.$gz.translation.translateStringWithMultipleKeysAsync(msg);
//In some cases the error may not be translatable, if this is not a debug run then it should show without the ?? that translating puts in keys not found
//so it's not as weird looking to the user

View File

@@ -654,16 +654,14 @@ export default {
ve.error +
"]";
if (ve.message) {
//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;
});
fldErr += ' - "' + transMessage + '"';
//NOTE: call sync version here as can't call async code from here
//so translations must already be pre-fetched to work here
fldErr +=
' - "' +
window.$gz.translation.translateStringWithMultipleKeys(
ve.message
) +
'"';
ret.push(fldErr);
} else {
ret.push(fldErr);

View File

@@ -301,7 +301,7 @@ export default {
//translation keys that start with LT:
//translate each and replace and return the string translated
// (fetch and cache any missing strings)
async translateStringWithMultipleKeys(s) {
async translateStringWithMultipleKeysAsync(s) {
let ret = s;
let found = s.match(/LT:[\w]*/gm);
if (found == null) {
@@ -324,6 +324,26 @@ export default {
return ret;
},
////////////////////////////////////////////////////////
// Take in a string that contains one or more
//translation keys that start with LT:
//translate each and replace and return the string translated
// (DOES NOT fetch and cache any missing strings, they must exist)
//this is the sync version to be used in non async capable code
translateStringWithMultipleKeys(s) {
let ret = s;
let found = s.match(/LT:[\w]*/gm);
if (found == null) {
return ret;
}
//replace
found.forEach(z => {
let translated = this.get(z.replace("LT:", ""));
//replace all
ret = ret.split(z).join(translated);
});
return ret;
},
////////////////////////////////////////////////////////
// dynamically set the vuetify language elements from

View File

@@ -102,7 +102,7 @@ export default {
this.languageName,
this.hour12
),
status: await window.$gz.translation.translateStringWithMultipleKeys(
status: await window.$gz.translation.translateStringWithMultipleKeysAsync(
o.statusText
),
jobId:

View File

@@ -97,7 +97,7 @@ export default {
res.data.forEach(function appendImportResultItem(value) {
outText += value + "\n";
});
vm.importResult = await window.$gz.translation.translateStringWithMultipleKeys(
vm.importResult = await window.$gz.translation.translateStringWithMultipleKeysAsync(
outText
);
}

View File

@@ -304,7 +304,7 @@ export default {
);
temp[
i
].name = await window.$gz.translation.translateStringWithMultipleKeys(
].name = await window.$gz.translation.translateStringWithMultipleKeysAsync(
temp[i].name
);

View File

@@ -115,7 +115,7 @@ export default {
this.languageName,
this.hour12
),
status: await window.$gz.translation.translateStringWithMultipleKeys(
status: await window.$gz.translation.translateStringWithMultipleKeysAsync(
o.statusText
),
jobId: