Fantasma Posted August 18, 2015 Report Posted August 18, 2015 More sophistical solution to avoid invoice attachment in email probleme open app/controllers/client_invoices.php if view function change $this->InvoiceDelivery->downloadInvoices(array($invoice->id)); to $this->InvoiceDelivery->streamInvoices(array($invoice->id)); in components/invoice_delivery/invoice_delivery.php under downloadInvoices() add the fallowing function public function streamInvoices(array $invoice_ids, array $options = null) { $invoices = $this->getInvoices($invoice_ids, true); $this->buildInvoices($invoices, true, $options)->stream(); } this will save the email attachement invoice in pdf . Can you paste the whole section of code for invoice_delivery.php page edit? (including original code + addition of new code)? Thanks Quote
activa Posted August 18, 2015 Report Posted August 18, 2015 Can you paste the whole section of code for invoice_delivery.php page edit? (including original code + addition of new code)? Thanks wich version of blesta do you use ? normally under the fucntion public function downloadInvoices(array $invoice_ids, array $options = null) { $invoices = $this->getInvoices($invoice_ids, true); $this->buildInvoices($invoices, true, $options)->download(); } add the fucntion public function streamInvoices(array $invoice_ids, array $options = null) { $invoices = $this->getInvoices($invoice_ids, true); $this->buildInvoices($invoices, true, $options)->stream(); } that all . Quote
Fantasma Posted August 18, 2015 Report Posted August 18, 2015 Got it fixed and working. @naja7host Any way to have this browser view (stream) for Admins too? Also, have the invoice load in a new tab/window when clicking View - instead of loading in the same window and taking you away from the portal page? Quote
Fantasma Posted August 18, 2015 Report Posted August 18, 2015 I modified app/controllers/admin_clients.php - now ADMINS/STAFF can also stream the invoice to view it! Change this FROM: // Download the invoice in the admin's language $this->components(array("InvoiceDelivery")); $this->InvoiceDelivery->downloadInvoices(array($invoice->id), array('language' => Configure::get("Blesta.language"))); exit; Changed TO: // Download the invoice in the admin's language $this->components(array("InvoiceDelivery")); $this->InvoiceDelivery->streamInvoices(array($invoice->id), array('language' => Configure::get("Blesta.language"))); exit; ---------------- Any idea or tips on how to make the invoice load in a new tab/window tho? Quote
Blesta Addons Posted August 18, 2015 Report Posted August 18, 2015 you should add target='blank' in the pdt file i think is client_invoices.pdt Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.