forked from verdnatura/hedera-web
Merge pull request 'dev → test' (!64) from dev into test
Reviewed-on: verdnatura/hedera-web#64
This commit is contained in:
commit
3a714debfc
|
@ -1,4 +1,4 @@
|
|||
hedera-web (24.14.6) stable; urgency=low
|
||||
hedera-web (24.14.7) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<htk-grid
|
||||
class="box vn-w-sm"
|
||||
show-header="false">
|
||||
<db-model property="model" id="tickets">
|
||||
<db-model property="model" id="invoices">
|
||||
SELECT id, ref, issued, amount, hasPdf
|
||||
FROM myInvoice
|
||||
ORDER BY issued DESC
|
||||
|
@ -16,8 +16,9 @@
|
|||
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
|
||||
<htk-column-spin title="_Import" column="amount" unit="€" digits="2"/>
|
||||
<htk-column-button
|
||||
renderer="donwloadRenderer"
|
||||
target="_blank"/>
|
||||
icon="download"
|
||||
tip="_Download PDF"
|
||||
on-clicked="onDownloadClick"/>
|
||||
</htk-grid>
|
||||
</div>
|
||||
</vn>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "24.14.6",
|
||||
"version": "24.14.7",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
SELECT CONCAT_WS('/', c.pdfsDir, vn.invoiceOut_getPath(#invoice))
|
||||
FROM config c
|
||||
JOIN myInvoice i
|
||||
WHERE i.id = #invoice
|
Loading…
Reference in New Issue