feat: refs #8387 changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Robert Ferrús 2025-01-15 10:25:21 +01:00
parent da3b8ac8d0
commit 93c9ef6f4c
3 changed files with 13 additions and 13 deletions

View File

@ -251,5 +251,6 @@
"Holidays to past days not available": "Holidays to past days not available", "Holidays to past days not available": "Holidays to past days not available",
"Price cannot be blank": "Price cannot be blank", "Price cannot be blank": "Price cannot be blank",
"There are tickets to be invoiced": "There are tickets to be invoiced", "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", "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", "All tickets have a route order": "Todos los tickets tienen orden de ruta",
"Price cannot be blank": "Price cannot be blank", "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) { if (ctx.isNewInstance) {
tagFk = ctx.instance.tagFk; tagFk = ctx.instance.tagFk;
value = ctx.instance.value; 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 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 (tagFk === validTag.id) {
if ( if ((value && !validValue.test(value)))
(value && !validValue.test(value)) ||
(newData && !validValue.test(newData))
)
throw new UserError('The value must be a number or a range of numbers'); throw new UserError('The value must be a number or a range of numbers');
} }
}); });