test → master #65

Merged
guillermo merged 6 commits from test into master 2024-06-25 07:11:49 +00:00
6 changed files with 14 additions and 52 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (24.14.6) stable; urgency=low hedera-web (24.14.8) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -3,30 +3,17 @@ import './style.scss';
export default new Class({ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
donwloadRenderer(column, invoice) {
var invoiceId = invoice.$.id;
if (invoice.$.hasPdf && invoiceId) { onDownloadClick(column, value, row) {
var params = { var model = this.$.invoices;
srv: 'rest:dms/invoice', var hasPdf = model.get(row, 'hasPdf');
invoice: invoiceId, var id = model.get(row, 'id');
access_token: this.conn.token
};
Object.assign(column, { if (hasPdf && id) {
tip: _('Download PDF'), let params = Vn.Url.makeUri({ access_token: this.conn.token });
disabled: false, window.open(`/api/InvoiceOuts/${id}/download?${params}`);
icon: 'download',
href: '?'+ Vn.Url.makeUri(params)
});
} else } else
Object.assign(column, { Htk.Toast.showWarning(_('Request the invoice to your salesperson'));
tip: _('Request the invoice to your salesperson'),
disabled: true,
icon: 'warning',
href: null
});
} }
}); });

View File

@ -6,7 +6,7 @@
<htk-grid <htk-grid
class="box vn-w-sm" class="box vn-w-sm"
show-header="false"> show-header="false">
<db-model property="model" id="tickets"> <db-model property="model" id="invoices">
SELECT id, ref, issued, amount, hasPdf SELECT id, ref, issued, amount, hasPdf
FROM myInvoice FROM myInvoice
ORDER BY issued DESC ORDER BY issued DESC
@ -16,8 +16,9 @@
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/> <htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
<htk-column-spin title="_Import" column="amount" unit="€" digits="2"/> <htk-column-spin title="_Import" column="amount" unit="€" digits="2"/>
<htk-column-button <htk-column-button
renderer="donwloadRenderer" icon="download"
target="_blank"/> tip="_Download PDF"
on-clicked="onDownloadClick"/>
</htk-grid> </htk-grid>
</div> </div>
</vn> </vn>

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "24.14.6", "version": "24.14.8",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -1,21 +0,0 @@
<?php
use Vn\Web\Security;
use Vn\Web\Util;
use Vn\Lib;
class Invoice extends Vn\Web\RestRequest {
const PARAMS = ['invoice'];
const SECURITY = Security::INVOKER;
function run($db) {
$pdfPath = $db->getValueFromFile(__DIR__ .'/invoice',
['invoice' =>(int) $_GET['invoice']]);
if (!$pdfPath)
throw new Lib\UserException(s('Invoice id not found'));
Util::printFile($pdfPath);
}
}

View File

@ -1,5 +0,0 @@
SELECT CONCAT_WS('/', c.pdfsDir, vn.invoiceOut_getPath(#invoice))
FROM config c
JOIN myInvoice i
WHERE i.id = #invoice