Jump to content

Recommended Posts

Posted
  On 8/7/2015 at 12:58 AM, naja7host said:

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

Posted
  On 8/18/2015 at 4:26 AM, Fantasma said:

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 .

Posted

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?

Posted

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?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...