feat: refs #8387 crudModel #3355
|
@ -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"
|
||||||
}
|
}
|
|
@ -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"
|
||||||
}
|
}
|
|
@ -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;
|
||||||
robert marked this conversation as resolved
Outdated
|
|||||||
const validTag = await models.Tag.findOne({where: {name: 'Longitud(cm)'}});
|
const validTag = await models.Tag.findOne({where: {name: 'Longitud(m)'}});
|
||||||
|
|
||||||
robert marked this conversation as resolved
alexm
commented
&& de value deberia ir a este nivel no? && de value deberia ir a este nivel no?
robert
commented
validTag.validationRegex comprueba si la columna validationRegex de la tabla tag tiene una expresión regular, y en caso de tener, se comprueba si el valor cumple la expresión regular validTag.validationRegex comprueba si la columna validationRegex de la tabla tag tiene una expresión regular, y en caso de tener, se comprueba si el valor cumple la expresión regular
|
|||||||
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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
findById