diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 1eb953d89..e4bdd035e 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -390,6 +390,7 @@ "The web user's email already exists": "El correo del usuario web ya existe", "Sales already moved": "Ya han sido transferidas", "The raid information is not correct": "La información de la redada no es correcta", - "There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero" + "There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero", + "An item type with the same code already exists": "Un tipo con el mismo código ya existe" } diff --git a/modules/item/back/locale/item-minimum-quantity/en.yml b/modules/item/back/locale/item-minimum-quantity/en.yml new file mode 100644 index 000000000..206b1d96b --- /dev/null +++ b/modules/item/back/locale/item-minimum-quantity/en.yml @@ -0,0 +1,5 @@ +name: Minimum Quantity +columns: + ended: Ended + code: Code + started: Started \ No newline at end of file diff --git a/modules/item/back/locale/item-minimum-quantity/es.yml b/modules/item/back/locale/item-minimum-quantity/es.yml new file mode 100644 index 000000000..68c67eeff --- /dev/null +++ b/modules/item/back/locale/item-minimum-quantity/es.yml @@ -0,0 +1,5 @@ +name: Cantidad Mínima +columns: + ended: Finaliza + quantity: Cantidad + started: Comienza diff --git a/modules/item/back/locale/item/en.yml b/modules/item/back/locale/item/en.yml index ea40fd34b..f5e6fcf9a 100644 --- a/modules/item/back/locale/item/en.yml +++ b/modules/item/back/locale/item/en.yml @@ -46,4 +46,4 @@ columns: itemFk: item density: density compression: compression - + minQuantity: min quantity diff --git a/modules/item/back/locale/item/es.yml b/modules/item/back/locale/item/es.yml index 973f5e94f..68020d452 100644 --- a/modules/item/back/locale/item/es.yml +++ b/modules/item/back/locale/item/es.yml @@ -46,4 +46,4 @@ columns: itemFk: artículo density: densidad compression: compresión - + minQuantity: Cantidad mínima diff --git a/modules/item/back/models/item-type.js b/modules/item/back/models/item-type.js new file mode 100644 index 000000000..4dc8adfc9 --- /dev/null +++ b/modules/item/back/models/item-type.js @@ -0,0 +1,9 @@ +let UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.rewriteDbError(function(err) { + if (err.code === 'ER_DUP_ENTRY') + return new UserError(`An item type with the same code already exists`); + return err; + }); +};