From 7e5f50e637a8e8f67e2527a1de46a556d1d4db26 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 08:30:39 +0100 Subject: [PATCH 1/3] refs #5072 email validation added --- db/changes/230401/00-updateIsToBeMailed.sql | 6 ++++++ loopback/locale/es.json | 3 ++- modules/client/back/models/client.js | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 db/changes/230401/00-updateIsToBeMailed.sql diff --git a/db/changes/230401/00-updateIsToBeMailed.sql b/db/changes/230401/00-updateIsToBeMailed.sql new file mode 100644 index 000000000..c04090663 --- /dev/null +++ b/db/changes/230401/00-updateIsToBeMailed.sql @@ -0,0 +1,6 @@ +UPDATE vn.client + SET isToBeMailed = FALSE + WHERE + mailAddress is NULL + AND email is NULL + AND isToBeMailed = TRUE; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d65054f37..1bf6c18f0 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -259,5 +259,6 @@ "Try again": "Vuelve a intentarlo", "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", "Failed to upload file": "Error al subir archivo", - "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists" + "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists", + "There is no assigned email for this client": "No hay correo asignado para este cliente" } diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index e07993f79..2d8e7bd27 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -141,6 +141,16 @@ module.exports = Self => { done(); } + Self.validateAsync('isToBeMailed', isToBeMailed, { + message: 'There is no assigned email for this client' + }); + + function isToBeMailed(err, done) { + if (this.isToBeMailed == true && !this.email) + err(); + done(); + } + Self.validateAsync('defaultAddressFk', isActive, {message: 'Unable to default a disabled consignee'} ); From fbf252b634772ff61c9f6bba70aa8c00bcfd5014 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 08:31:56 +0100 Subject: [PATCH 2/3] refs #5072 template strings --- db/changes/230401/00-updateIsToBeMailed.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/230401/00-updateIsToBeMailed.sql b/db/changes/230401/00-updateIsToBeMailed.sql index c04090663..1bb177f57 100644 --- a/db/changes/230401/00-updateIsToBeMailed.sql +++ b/db/changes/230401/00-updateIsToBeMailed.sql @@ -1,4 +1,4 @@ -UPDATE vn.client +UPDATE `vn`.`client` SET isToBeMailed = FALSE WHERE mailAddress is NULL From f7a65cfa6ea63d6f5811fc6d09a3df6efcac2282 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 12:35:09 +0100 Subject: [PATCH 3/3] refs #5072 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00cafc2b..bda004470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. +- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail ## [2302.01] - 2023-01-26