Jump to content

Recommended Posts

Posted

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

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...