Hi,
I've just upgraded to 4.0.0 -- everything went smoothly, BUT... that annoying invoice downloading reappeared
So here is the patch. I really think there should be a "view" (= stream to browser) AND "download" links on the invoice row.
I've simply created a streamInvoices function and thats it.
*** ../_extract/blesta/app/controllers/admin_billing.php 2017-03-14 10:23:18.000000000 +0100
--- ./blesta/app/controllers/admin_billing.php 2017-03-18 12:22:23.230248000 +0100
***************
*** 282,288 ****
// Print invoices
if (!array_key_exists('mark_printed', $this->post)) {
$this->components(['InvoiceDelivery']);
! $this->InvoiceDelivery->downloadInvoices($invoice_ids);
exit;
} else {
// Mark invoices printed
--- 282,288 ----
// Print invoices
if (!array_key_exists('mark_printed', $this->post)) {
$this->components(['InvoiceDelivery']);
! $this->InvoiceDelivery->streamInvoices($invoice_ids);
exit;
} else {
// Mark invoices printed
diff -cr ../_extract/blesta/app/controllers/admin_clients.php ./blesta/app/controllers/admin_clients.php
*** ../_extract/blesta/app/controllers/admin_clients.php 2017-03-14 10:23:18.000000000 +0100
--- ./blesta/app/controllers/admin_clients.php 2017-03-18 12:21:51.650062000 +0100
***************
*** 4292,4298 ****
// Download the invoice in the admin's language
$this->components(['InvoiceDelivery']);
! $this->InvoiceDelivery->downloadInvoices([$invoice->id], ['language' => Configure::get('Blesta.language')]);
exit;
}
--- 4292,4298 ----
// Download the invoice in the admin's language
$this->components(['InvoiceDelivery']);
! $this->InvoiceDelivery->streamInvoices([$invoice->id], ['language' => Configure::get('Blesta.language')]);
exit;
}
diff -cr ../_extract/blesta/app/controllers/client_invoices.php ./blesta/app/controllers/client_invoices.php
*** ../_extract/blesta/app/controllers/client_invoices.php 2017-03-14 10:23:18.000000000 +0100
--- ./blesta/app/controllers/client_invoices.php 2017-03-18 12:22:45.823894000 +0100
***************
*** 114,120 ****
}
$this->components(['InvoiceDelivery']);
! $this->InvoiceDelivery->downloadInvoices([$invoice->id]);
exit;
}
}
--- 114,120 ----
}
$this->components(['InvoiceDelivery']);
! $this->InvoiceDelivery->streamInvoices([$invoice->id]);
exit;
}
}
diff -cr ../_extract/blesta/components/invoice_delivery/invoice_delivery.php ./blesta/components/invoice_delivery/invoice_delivery.php
*** ../_extract/blesta/components/invoice_delivery/invoice_delivery.php 2017-03-14 10:23:20.000000000 +0100
--- ./blesta/components/invoice_delivery/invoice_delivery.php 2017-03-18 12:20:53.422226000 +0100
***************
*** 310,315 ****
--- 310,320 ----
$invoices = $this->getInvoices($invoice_ids, true);
$this->buildInvoices($invoices, true, $options)->download();
}
+ public function streamInvoices(array $invoice_ids, array $options = null) {
+ $invoices = $this->getInvoices($invoice_ids, true);
+ $this->buildInvoices($invoices, true, $options)->stream();
+ }
+
/**
* Returns an errors raised