From bcbbee411f50944ab035b1b9bbeaa9494f2a940a Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 29 May 2024 10:45:34 +0200 Subject: [PATCH 1/3] fix: refs #7498 Download invoice out error --- forms/ecomerce/invoices/index.js | 29 ++++++++--------------------- forms/ecomerce/invoices/ui.xml | 7 ++++--- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/forms/ecomerce/invoices/index.js b/forms/ecomerce/invoices/index.js index 5c0960b9..4ba0162e 100644 --- a/forms/ecomerce/invoices/index.js +++ b/forms/ecomerce/invoices/index.js @@ -3,30 +3,17 @@ import './style.scss'; export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), - - donwloadRenderer(column, invoice) { - var invoiceId = invoice.$.id; - if (invoice.$.hasPdf && invoiceId) { - var params = { - srv: 'rest:dms/invoice', - invoice: invoiceId, - access_token: this.conn.token - }; + onDownloadClick(column, value, row) { + var model = this.$.invoices; + var hasPdf = model.get(row, 'hasPdf'); + var id = model.get(row, 'id'); - Object.assign(column, { - tip: _('Download PDF'), - disabled: false, - icon: 'download', - href: '?'+ Vn.Url.makeUri(params) - }); + if (hasPdf && id) { + let params = Vn.Url.makeUri({ access_token: this.conn.token }); + window.open(`/api/InvoiceOuts/${id}/download?${params}`); } else - Object.assign(column, { - tip: _('Request the invoice to your salesperson'), - disabled: true, - icon: 'warning', - href: null - }); + Htk.Toast.showWarning(_('Request the invoice to your salesperson')); } }); diff --git a/forms/ecomerce/invoices/ui.xml b/forms/ecomerce/invoices/ui.xml index aa6244a0..30bf2f93 100644 --- a/forms/ecomerce/invoices/ui.xml +++ b/forms/ecomerce/invoices/ui.xml @@ -6,7 +6,7 @@ - + SELECT id, ref, issued, amount, hasPdf FROM myInvoice ORDER BY issued DESC @@ -16,8 +16,9 @@ + icon="download" + tip="_Download PDF" + on-clicked="onDownloadClick"/> From 90e2b0abb52d829e17284451b06ad7aae359b57f Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 7 Jun 2024 08:51:03 +0200 Subject: [PATCH 2/3] refactor: refs #7498 Deleted method --- rest/dms/invoice.php | 21 --------------------- rest/dms/invoice.sql | 5 ----- 2 files changed, 26 deletions(-) delete mode 100644 rest/dms/invoice.php delete mode 100644 rest/dms/invoice.sql diff --git a/rest/dms/invoice.php b/rest/dms/invoice.php deleted file mode 100644 index 4afa3f4c..00000000 --- a/rest/dms/invoice.php +++ /dev/null @@ -1,21 +0,0 @@ -getValueFromFile(__DIR__ .'/invoice', - ['invoice' =>(int) $_GET['invoice']]); - - if (!$pdfPath) - throw new Lib\UserException(s('Invoice id not found')); - - Util::printFile($pdfPath); - } -} - diff --git a/rest/dms/invoice.sql b/rest/dms/invoice.sql deleted file mode 100644 index cf3725b5..00000000 --- a/rest/dms/invoice.sql +++ /dev/null @@ -1,5 +0,0 @@ - -SELECT CONCAT_WS('/', c.pdfsDir, vn.invoiceOut_getPath(#invoice)) - FROM config c - JOIN myInvoice i - WHERE i.id = #invoice From 05c71c74256660ad5ae8e4d5aa9a427a5967a343 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 11 Jun 2024 08:54:33 +0200 Subject: [PATCH 3/3] refactor: refs #7498 Version increased --- debian/changelog | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 85ed2fd6..6359f111 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (24.14.6) stable; urgency=low +hedera-web (24.14.7) stable; urgency=low * Initial Release. diff --git a/package.json b/package.json index 45911592..22321789 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "24.14.6", + "version": "24.14.7", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": {