From e0ed9072c921daf2238155d9a2631f578e45901d Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 14 Nov 2019 08:16:52 +0100 Subject: [PATCH] unified LCR and CORE #1868 --- back/methods/chat/sendMessage.js | 4 +- back/methods/chat/spec/send.spec.js | 9 ++- db/changes/10110-postCampaign/00-country.sql | 10 +++ db/changes/10110-postCampaign/00-sample.sql | 8 +++ db/dump/fixtures.sql | 19 ++--- print/common/css/email.css | 7 +- .../email-header/assets/css/style.css | 2 +- print/templates/email/sepa-core/locale/fr.yml | 27 +++++++ .../templates/email/sepa-core/sepa-core.html | 4 +- .../templates/reports/sepa-core/locale/es.yml | 2 +- .../templates/reports/sepa-core/locale/fr.yml | 70 +++++++++---------- .../templates/reports/sepa-core/locale/pt.yml | 4 +- .../reports/sepa-core/sepa-core.html | 14 +++- 13 files changed, 120 insertions(+), 60 deletions(-) create mode 100644 db/changes/10110-postCampaign/00-country.sql create mode 100644 db/changes/10110-postCampaign/00-sample.sql create mode 100644 print/templates/email/sepa-core/locale/fr.yml diff --git a/back/methods/chat/sendMessage.js b/back/methods/chat/sendMessage.js index ac1d3c956..2ab07af8c 100644 --- a/back/methods/chat/sendMessage.js +++ b/back/methods/chat/sendMessage.js @@ -28,8 +28,10 @@ module.exports = Self => { const models = Self.app.models; const accessToken = ctx.req.accessToken; const sender = await models.Account.findById(accessToken.userId); + const recipient = to.replace('@', ''); - return sendMessage(to, `@${sender.name}: ${message}`); + if (sender.name != recipient) + return sendMessage(to, `@${sender.name}: ${message}`); }; async function sendMessage(name, message) { diff --git a/back/methods/chat/spec/send.spec.js b/back/methods/chat/spec/send.spec.js index 5b01def9b..ebb62a0c8 100644 --- a/back/methods/chat/spec/send.spec.js +++ b/back/methods/chat/spec/send.spec.js @@ -1,11 +1,18 @@ const app = require('vn-loopback/server/server'); describe('chat sendMessage()', () => { - it('should return a response', async() => { + it('should return a "Fake notification sent" as response', async() => { let ctx = {req: {accessToken: {userId: 1}}}; let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something'); expect(response.statusCode).toEqual(200); expect(response.message).toEqual('Fake notification sent'); }); + + it('should not return a response', async() => { + let ctx = {req: {accessToken: {userId: 18}}}; + let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something'); + + expect(response).toBeUndefined(); + }); }); diff --git a/db/changes/10110-postCampaign/00-country.sql b/db/changes/10110-postCampaign/00-country.sql new file mode 100644 index 000000000..dcc883ab8 --- /dev/null +++ b/db/changes/10110-postCampaign/00-country.sql @@ -0,0 +1,10 @@ +USE `vn`; + +UPDATE `vn`.`country` SET `ibanLength` = '24' WHERE (`id` = 1); +UPDATE `vn`.`country` SET `ibanLength` = '27' WHERE (`id` = 2); +UPDATE `vn`.`country` SET `ibanLength` = '22' WHERE (`id` = 3); +UPDATE `vn`.`country` SET `ibanLength` = '24' WHERE (`id` = 4); +UPDATE `vn`.`country` SET `ibanLength` = '18' WHERE (`id` = 5); +UPDATE `vn`.`country` SET `ibanLength` = '25' WHERE (`id` = 8); +UPDATE `vn`.`country` SET `ibanLength` = '27' WHERE (`id` = 19); +UPDATE `vn`.`country` SET `ibanLength` = '24' WHERE (`id` = 30); diff --git a/db/changes/10110-postCampaign/00-sample.sql b/db/changes/10110-postCampaign/00-sample.sql new file mode 100644 index 000000000..68e9d1a0f --- /dev/null +++ b/db/changes/10110-postCampaign/00-sample.sql @@ -0,0 +1,8 @@ +USE `vn`; + +UPDATE `vn`.`sample` SET `description` = 'Bienvenida como nuevo cliente' WHERE (`id` = '12'); +UPDATE `vn`.`sample` SET `description` = 'Instalación y configuración de impresora de coronas' WHERE (`id` = '13'); +UPDATE `vn`.`sample` SET `description` = 'Solicitud de domiciliación bancaria' WHERE (`id` = '14'); +UPDATE `vn`.`sample` SET `description` = 'Aviso inicial por saldo deudor' WHERE (`id` = '15'); +UPDATE `vn`.`sample` SET `description` = 'Aviso reiterado por saldo deudor' WHERE (`id` = '16'); +UPDATE `vn`.`sample` SET `isVisible` = '0' WHERE (`id` = '17'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index e228bdfc6..cee62f317 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -53,13 +53,14 @@ INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossF INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`) VALUES - (1, 'España', 0, 'ES', 1, 22), - (2, 'Italia', 1, 'IT', 1, 25), - (3, 'Alemania', 1, 'DE', 1, 20), - (4, 'Rumania', 1, 'RO', 1, 22), - (5, 'Holanda', 1, 'NL', 1, 16), - (19,'Francia', 1, 'FR', 1, 25), - (30,'Canarias', 1, 'IC', 1, 22); + (1, 'España', 0, 'ES', 1, 24), + (2, 'Italia', 1, 'IT', 1, 27), + (3, 'Alemania', 1, 'DE', 1, 22), + (4, 'Rumania', 1, 'RO', 1, 24), + (5, 'Holanda', 1, 'NL', 1, 18), + (8, 'Portugal', 1, 'PT', 1, 27), + (19,'Francia', 1, 'FR', 1, 27), + (30,'Canarias', 1, 'IC', 1, 24); INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`) VALUES @@ -195,9 +196,9 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city VALUES (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), + (105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), (107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), diff --git a/print/common/css/email.css b/print/common/css/email.css index 3bb9225c8..6e6350ff5 100644 --- a/print/common/css/email.css +++ b/print/common/css/email.css @@ -23,12 +23,11 @@ body { .grid-block { min-width: 300px; max-width: 600px; - width: 600px; - margin: 0 auto + margin: 0 auto; + color: #333 } h1 { font-weight: 100; - font-size: 1.5em; - color: #333; + font-size: 1.5em } diff --git a/print/core/components/email-header/assets/css/style.css b/print/core/components/email-header/assets/css/style.css index 5d2f658ce..4db5e2b2e 100644 --- a/print/core/components/email-header/assets/css/style.css +++ b/print/core/components/email-header/assets/css/style.css @@ -8,7 +8,7 @@ header .logo img { header .topbar { background-color: #95d831; - height: 25px + height: 10px } .topbar:after { diff --git a/print/templates/email/sepa-core/locale/fr.yml b/print/templates/email/sepa-core/locale/fr.yml new file mode 100644 index 000000000..98bd7593a --- /dev/null +++ b/print/templates/email/sepa-core/locale/fr.yml @@ -0,0 +1,27 @@ +subject: Autorisation pour débit +title: Autorisation pour débit +description: + dear: Messieurs + instructions:

Étant donné les excellentes relations existantes entre nos + deux sociétés et en vue de faciliter les processus de + paiement de nos factures, nous vous suggérons l'utilisation + du système française de compensation LCR.

+

Ce service consiste à effectuer des recouvrements + automatiques, de manière électronique, de nos effets - + lettres de change et billets à ordre - tirés sur votre société + en Euro, qui présente comme principal avantage pour vous + la substantielle réduction de coûts dans des termes de frais + et commissions bancaires.

+

Dans le cas où vous accepteriez notre proposition, à + l’échéance de chaque effet, votre compte sera débité + automatiquement par votre Banque. + Ainsi, nous vous demandons de signer et envoyer à votre + Banque l'original de l'autorisation pour débit en annexe, + dûment remplie, et de nous retourner une photocopie de la + dite autorisation.

+

Ce système étant basé sur la transmission de données de + manière électronique, le maniement de documents + physiques á été éliminé

+

En vous remercieront pour votre collaboration, nous vous + prions d’agréer, Messieurs, nos salutations distinguées.

+ conclusion: Bien cordialement diff --git a/print/templates/email/sepa-core/sepa-core.html b/print/templates/email/sepa-core/sepa-core.html index 4f3900262..445b7efc9 100644 --- a/print/templates/email/sepa-core/sepa-core.html +++ b/print/templates/email/sepa-core/sepa-core.html @@ -28,11 +28,11 @@

{{ $t('title') }}

{{$t('description.dear')}},

-

{{$t('description.instructions')}}

+

{{$t('description.conclusion')}}

- +
{{$t('supplier.identifier')}} - ES89000B97367486 + +
ES89000B97367486
+
B97367486-000
+ {{$t('supplier.name')}} @@ -110,14 +113,19 @@
{{client.countryCode.substr(0, 1)}} {{client.countryCode.substr(1, 1)}} - +
- {{$t('client.accountNumberFormat')}} + {{$t('client.accountNumberFormat', [ + $t(`${client.country}`), + client.ibanLength, + client.countryCode + ])}} +