From e8500f926c6af4cbc1c14a528555adf56f0fcab7 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 25 Oct 2022 08:19:56 +0200 Subject: [PATCH] feat(invoiceIn): add email --- .../invoiceIn/back/methods/invoice-in/invoiceInEmail.js | 7 ++----- modules/invoiceIn/front/descriptor/index.js | 1 - print/templates/email/invoiceIn/invoiceIn.js | 8 -------- print/templates/reports/invoiceIn/invoiceIn.html | 2 +- print/templates/reports/invoiceIn/sql/invoice.sql | 3 +-- 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js b/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js index b04108bd7..0768541a8 100644 --- a/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js +++ b/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js @@ -35,19 +35,16 @@ module.exports = Self => { } }); - Self.invoiceInEmail = async(ctx, id) => { + Self.invoiceInEmail = async ctx => { const args = Object.assign({}, ctx.args); const params = { - recipient: 'alexm@verdnatura.es', // args.recipient, + recipient: args.recipient, lang: ctx.req.getLocale() }; - console.log(id); - delete args.ctx; for (const param in args) params[param] = args[param]; - console.log(params); const email = new Email('invoiceIn', params); diff --git a/modules/invoiceIn/front/descriptor/index.js b/modules/invoiceIn/front/descriptor/index.js index 6c844a233..5cd00d743 100644 --- a/modules/invoiceIn/front/descriptor/index.js +++ b/modules/invoiceIn/front/descriptor/index.js @@ -8,7 +8,6 @@ class Controller extends Descriptor { set invoiceIn(value) { this.entity = value; - console.log(value); } get entryFilter() { diff --git a/print/templates/email/invoiceIn/invoiceIn.js b/print/templates/email/invoiceIn/invoiceIn.js index 43e95120c..f7a472eb2 100755 --- a/print/templates/email/invoiceIn/invoiceIn.js +++ b/print/templates/email/invoiceIn/invoiceIn.js @@ -4,14 +4,6 @@ const emailFooter = new Component('email-footer'); module.exports = { name: 'invoiceIn', - async serverPrefetch() { - this.invoice = await this.fetchInvoice(this.id); - }, - methods: { - fetchInvoice(reference) { - return this.findOneFromDef('invoice', [reference]); - }, - }, components: { 'email-header': emailHeader.build(), 'email-footer': emailFooter.build() diff --git a/print/templates/reports/invoiceIn/invoiceIn.html b/print/templates/reports/invoiceIn/invoiceIn.html index 5f15e6a9a..8919403b9 100644 --- a/print/templates/reports/invoiceIn/invoiceIn.html +++ b/print/templates/reports/invoiceIn/invoiceIn.html @@ -202,7 +202,7 @@ diff --git a/print/templates/reports/invoiceIn/sql/invoice.sql b/print/templates/reports/invoiceIn/sql/invoice.sql index 2f6929b2a..fe9ef1e9e 100644 --- a/print/templates/reports/invoiceIn/sql/invoice.sql +++ b/print/templates/reports/invoiceIn/sql/invoice.sql @@ -6,8 +6,7 @@ SELECT s.street AS postalAddress, s.nif, s.phone, - p.name payMethod, - c.companyCode + p.name payMethod FROM invoiceIn i JOIN supplier s ON s.id = i.supplierFk JOIN company c ON c.id = i.companyFk