feat: refs #8387 crudModel #3355

Open
robert wants to merge 11 commits from 8387-itemTagCrudModel into dev
3 changed files with 13 additions and 13 deletions
Showing only changes of commit 93c9ef6f4c - Show all commits

View File

@ -211,7 +211,7 @@
"Name should be uppercase": "Name should be uppercase",
"You cannot update these fields": "You cannot update these fields",
"CountryFK cannot be empty": "Country cannot be empty",
"No tickets to invoice": "There are no tickets to invoice that meet the invoicing requirements",
"No tickets to invoice": "There are no tickets to invoice that meet the invoicing requirements",
"You are not allowed to modify the alias": "You are not allowed to modify the alias",
"You already have the mailAlias": "You already have the mailAlias",
"This machine is already in use.": "This machine is already in use.",
@ -251,5 +251,6 @@
"Holidays to past days not available": "Holidays to past days not available",
"Price cannot be blank": "Price cannot be blank",
"There are tickets to be invoiced": "There are tickets to be invoiced",
"The address of the customer must have information about Incoterms and Customs Agent": "The address of the customer must have information about Incoterms and Customs Agent"
}
"The address of the customer must have information about Incoterms and Customs Agent": "The address of the customer must have information about Incoterms and Customs Agent",
"The value must be a number or a range of numbers": "The value must be a number or a range of numbers"
}

View File

@ -398,5 +398,6 @@
"Holidays to past days not available": "Las vacaciones a días pasados no están disponibles",
"All tickets have a route order": "Todos los tickets tienen orden de ruta",
"Price cannot be blank": "Price cannot be blank",
"There are tickets to be invoiced": "La zona tiene tickets por facturar"
}
"There are tickets to be invoiced": "La zona tiene tickets por facturar",
"The value must be a number or a range of numbers": "The value must be a number or a range of numbers"
}

View File

@ -19,17 +19,15 @@ module.exports = Self => {
if (ctx.isNewInstance) {
tagFk = ctx.instance.tagFk;
value = ctx.instance.value;
} else {
tagFk = ctx.currentInstance.tagFk;
value = ctx.data.value;
}
const newData = ctx.data.value || null;
const currentData = ctx.currentInstance.value || null;
const models = Self.app.models;
const validTag = await models.Tag.findOne({where: {name: 'Longitud(cm)'}});
const validTag = await models.Tag.findOne({where: {name: 'Longitud(m)'}});
if (tagFk === validTag.id || (currentData && currentData === validTag.id)) {
if (
(value && !validValue.test(value)) ||
(newData && !validValue.test(newData))
)
if (tagFk === validTag.id) {
if ((value && !validValue.test(value)))
throw new UserError('The value must be a number or a range of numbers');
}
});