Jump to content

File name for invoice e-mail attachment differs from "View Invoice" one


Simba

Recommended Posts

I was curious to know if there was a specific reason that the PDF file that is generated and downloaded when clicking on "View Invoice" from an order in the admin interface receives a different file name than when the system sends an invoice to a customer as an attachment.  This may not be immediately visible if options like "Add current year to invoice number" and "Position of the year date -> Before the sequential number" are not set, but if they are, it's clear that the file name generation is different than the number in the body of the PDF.

From what I can tell, the file name generated for the e-mail attachment is set in classes/order/OrderHistory.php , in the function sendEmail.  It utilizes its own logic/method to generate it:

$file_attachement['invoice']['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf';

... instead of using something like:

$file_attachement['invoice']['name'] = $pdf->filename;

For consistency sake, wouldn't it make more sense to have the invoice file name generation be the same everywhere?

As another, small nit pick, "attachment" is not spelled with that extra e, so the $file_attachement variable name is slightly misspelled.

Edited by Simba (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...