From d1dce73a3374d6401392736aee8f30402e1fe7ee Mon Sep 17 00:00:00 2001
From: alexm
Date: Mon, 14 Nov 2022 08:50:38 +0100
Subject: [PATCH 1/5] feat: creat email/vehicle-event-expired
---
.../vehicle-event-expired/assets/css/import.js | 11 +++++++++++
.../email/vehicle-event-expired/attachments.json | 6 ++++++
.../email/vehicle-event-expired/locale/es.yml | 3 +++
.../vehicle-event-expired.html | 8 ++++++++
.../vehicle-event-expired/vehicle-event-expired.js | 9 +++++++++
.../vehicle-event-expired/assets/css/import.js | 13 ++++++++-----
.../vehicle-event-expired/vehicle-event-expired.js | 2 +-
print/templates/reports/zone/zone.js | 2 +-
8 files changed, 47 insertions(+), 7 deletions(-)
create mode 100644 print/templates/email/vehicle-event-expired/assets/css/import.js
create mode 100644 print/templates/email/vehicle-event-expired/attachments.json
create mode 100644 print/templates/email/vehicle-event-expired/locale/es.yml
create mode 100644 print/templates/email/vehicle-event-expired/vehicle-event-expired.html
create mode 100755 print/templates/email/vehicle-event-expired/vehicle-event-expired.js
diff --git a/print/templates/email/vehicle-event-expired/assets/css/import.js b/print/templates/email/vehicle-event-expired/assets/css/import.js
new file mode 100644
index 000000000..4b4bb7086
--- /dev/null
+++ b/print/templates/email/vehicle-event-expired/assets/css/import.js
@@ -0,0 +1,11 @@
+const Stylesheet = require(`vn-print/core/stylesheet`);
+
+const path = require('path');
+const vnPrintPath = path.resolve('print');
+
+module.exports = new Stylesheet([
+ `${vnPrintPath}/common/css/spacing.css`,
+ `${vnPrintPath}/common/css/misc.css`,
+ `${vnPrintPath}/common/css/layout.css`,
+ `${vnPrintPath}/common/css/email.css`])
+ .mergeStyles();
diff --git a/print/templates/email/vehicle-event-expired/attachments.json b/print/templates/email/vehicle-event-expired/attachments.json
new file mode 100644
index 000000000..6b56392a0
--- /dev/null
+++ b/print/templates/email/vehicle-event-expired/attachments.json
@@ -0,0 +1,6 @@
+[
+ {
+ "filename": "vehicle-event-expired.pdf",
+ "component": "vehicle-event-expired"
+ }
+]
diff --git a/print/templates/email/vehicle-event-expired/locale/es.yml b/print/templates/email/vehicle-event-expired/locale/es.yml
new file mode 100644
index 000000000..f6fff468c
--- /dev/null
+++ b/print/templates/email/vehicle-event-expired/locale/es.yml
@@ -0,0 +1,3 @@
+subject: Expiración Tarjetas Vehículos
+title: Expiración Tarjetas Vehículos
+description: A continuación se adjunta el informe de expiración de tarjetas vehículos
diff --git a/print/templates/email/vehicle-event-expired/vehicle-event-expired.html b/print/templates/email/vehicle-event-expired/vehicle-event-expired.html
new file mode 100644
index 000000000..f4c1ebc1b
--- /dev/null
+++ b/print/templates/email/vehicle-event-expired/vehicle-event-expired.html
@@ -0,0 +1,8 @@
+
+
+
diff --git a/print/templates/email/vehicle-event-expired/vehicle-event-expired.js b/print/templates/email/vehicle-event-expired/vehicle-event-expired.js
new file mode 100755
index 000000000..1c228d2b5
--- /dev/null
+++ b/print/templates/email/vehicle-event-expired/vehicle-event-expired.js
@@ -0,0 +1,9 @@
+const Component = require(`vn-print/core/component`);
+const emailBody = new Component('email-body');
+
+module.exports = {
+ name: 'vehicle-event-expired',
+ components: {
+ 'email-body': emailBody.build()
+ }
+};
diff --git a/print/templates/reports/vehicle-event-expired/assets/css/import.js b/print/templates/reports/vehicle-event-expired/assets/css/import.js
index fd8796c2b..37a98dfdd 100644
--- a/print/templates/reports/vehicle-event-expired/assets/css/import.js
+++ b/print/templates/reports/vehicle-event-expired/assets/css/import.js
@@ -1,9 +1,12 @@
-const Stylesheet = require(`${appPath}/core/stylesheet`);
+const Stylesheet = require(`vn-print/core/stylesheet`);
+
+const path = require('path');
+const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
- `${appPath}/common/css/spacing.css`,
- `${appPath}/common/css/misc.css`,
- `${appPath}/common/css/layout.css`,
- `${appPath}/common/css/report.css`,
+ `${vnPrintPath}/common/css/spacing.css`,
+ `${vnPrintPath}/common/css/misc.css`,
+ `${vnPrintPath}/common/css/layout.css`,
+ `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`])
.mergeStyles();
diff --git a/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js b/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js
index 278caeabf..ab6cffc00 100755
--- a/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js
+++ b/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js
@@ -1,4 +1,4 @@
-const Component = require(`${appPath}/core/component`);
+const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
module.exports = {
diff --git a/print/templates/reports/zone/zone.js b/print/templates/reports/zone/zone.js
index 463c28acf..720542cd6 100755
--- a/print/templates/reports/zone/zone.js
+++ b/print/templates/reports/zone/zone.js
@@ -1,4 +1,4 @@
-const Component = require(`${appPath}/core/component`);
+const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
module.exports = {
From 3c771fc771cf1eb730b09e9cdfc768b2f6c7e12a Mon Sep 17 00:00:00 2001
From: Pau Navarro
Date: Mon, 14 Nov 2022 08:53:00 +0100
Subject: [PATCH 2/5] refactor missing URL's refs #4609
---
print/templates/email/client-welcome/client-welcome.html | 2 +-
print/templates/email/client-welcome/locale/es.yml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/print/templates/email/client-welcome/client-welcome.html b/print/templates/email/client-welcome/client-welcome.html
index 07b61b3e6..585c1a11b 100644
--- a/print/templates/email/client-welcome/client-welcome.html
+++ b/print/templates/email/client-welcome/client-welcome.html
@@ -31,7 +31,7 @@
{{$t('clientId')}}: {{client.id}}
{{$t('user')}}: {{client.userName}}
diff --git a/print/templates/email/client-welcome/locale/es.yml b/print/templates/email/client-welcome/locale/es.yml
index 1257113ac..478fd242c 100644
--- a/print/templates/email/client-welcome/locale/es.yml
+++ b/print/templates/email/client-welcome/locale/es.yml
@@ -1,8 +1,8 @@
subject: Bienvenido a Verdnatura
title: "¡Te damos la bienvenida!"
dearClient: Estimado cliente
-clientData: 'Tus datos para poder comprar en la web de Verdnatura (https://verdnatura.es)
+clientData: 'Tus datos para poder comprar en la web de Verdnatura (https://shop.verdnatura.es)
o en nuestras aplicaciones para iOS y Android, son'
From 6e94d7f68e25bca8c13404e55e329c7bda7750c6 Mon Sep 17 00:00:00 2001
From: vicent
Date: Mon, 14 Nov 2022 11:00:13 +0100
Subject: [PATCH 3/5] fix: nombre variable incorrecto
---
modules/ticket/front/sale/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js
index 85a862bbb..f64d0b61b 100644
--- a/modules/ticket/front/sale/index.js
+++ b/modules/ticket/front/sale/index.js
@@ -89,7 +89,7 @@ class Controller extends Section {
getUsesMana() {
this.$http.get(`Sales/usesMana`)
.then(res => {
- this.useMana = res.data;
+ this.usesMana = res.data;
});
}
From 4a063cc310dbebef76966d569678f824e0596a81 Mon Sep 17 00:00:00 2001
From: alexandre
Date: Thu, 17 Nov 2022 09:25:18 +0100
Subject: [PATCH 4/5] refs #4780 verification deleted
---
modules/client/back/methods/client/setPassword.js | 6 ------
.../back/methods/client/specs/setPassword.spec.js | 15 ---------------
2 files changed, 21 deletions(-)
diff --git a/modules/client/back/methods/client/setPassword.js b/modules/client/back/methods/client/setPassword.js
index 2f0ebca5b..e3fc9bbf8 100644
--- a/modules/client/back/methods/client/setPassword.js
+++ b/modules/client/back/methods/client/setPassword.js
@@ -23,12 +23,6 @@ module.exports = Self => {
Self.setPassword = async function(ctx, id, newPassword) {
const models = Self.app.models;
- const userId = ctx.req.accessToken.userId;
-
- const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson');
-
- if (!isSalesPerson)
- throw new UserError(`Not enough privileges to edit a client`);
const isClient = await models.Client.findById(id, null);
const isUserAccount = await models.UserAccount.findById(id, null);
diff --git a/modules/client/back/methods/client/specs/setPassword.spec.js b/modules/client/back/methods/client/specs/setPassword.spec.js
index 13065ca12..03334918b 100644
--- a/modules/client/back/methods/client/specs/setPassword.spec.js
+++ b/modules/client/back/methods/client/specs/setPassword.spec.js
@@ -6,21 +6,6 @@ describe('Client setPassword', () => {
req: {accessToken: {userId: salesPersonId}}
};
- it(`should throw an error if you don't have enough permissions`, async() => {
- let error;
- const employeeId = 1;
- const ctx = {
- req: {accessToken: {userId: employeeId}}
- };
- try {
- await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!');
- } catch (e) {
- error = e;
- }
-
- expect(error.message).toEqual(`Not enough privileges to edit a client`);
- });
-
it('should throw an error the setPassword target is not just a client but a worker', async() => {
let error;
From 721f89b76c6fbc3593d82b410a0ef44541bd6778 Mon Sep 17 00:00:00 2001
From: joan
Date: Thu, 17 Nov 2022 16:39:12 +0100
Subject: [PATCH 5/5] fix(ordersFilter): wrong table schema
---
modules/monitor/back/methods/sales-monitor/ordersFilter.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/monitor/back/methods/sales-monitor/ordersFilter.js b/modules/monitor/back/methods/sales-monitor/ordersFilter.js
index 6ae4042b6..a80ea822e 100644
--- a/modules/monitor/back/methods/sales-monitor/ordersFilter.js
+++ b/modules/monitor/back/methods/sales-monitor/ordersFilter.js
@@ -53,7 +53,7 @@ module.exports = Self => {
JOIN client c ON c.id = o.customer_id
JOIN address a ON a.id = o.address_id
JOIN agencyMode am ON am.id = o.agency_id
- JOIN user u ON u.id = c.salesPersonFk
+ JOIN account.user u ON u.id = c.salesPersonFk
JOIN workerTeamCollegues wtc ON c.salesPersonFk = wtc.collegueFk`);
if (!filter.where) filter.where = {};