Jump to content

Rename PDF Generate for Proforma Invoice


Mas-J

Recommended Posts

Hello Everyone,

I activate the proforma invoice feature for invoice.

I want rename the PDF being sent to client if the invoice status is Unpaid become "Proforma Invoice-1900001" instead of the standard name "Invoice-1900001"

So, it will make a differenciation between Unpaid invoice and Paid invoice PDF when client recieved it.

Do you know what file and script should I edit to make it possible ?

Link to comment
Share on other sites

  • 11 months later...
  • 1 month later...

Changing/Translating Filename

The default filename for invoices is Invoice-xxx. For quotes, this is Quote-xxx. For both, xxx is the ID of the invoice or quote. It may be desirable to change the filenames the clients see or translate into other languages. Achieve this in the same way as any text within WHMCS, by using the Language Files. Look for these strings:

$_LANG['invoicefilename'] = "Invoice-";
$_LANG['quotefilename'] = "Quote-";
Link to comment
Share on other sites

On 8/1/2020 at 7:17 PM, zimbahost said:

Changing/Translating Filename

The default filename for invoices is Invoice-xxx. For quotes, this is Quote-xxx. For both, xxx is the ID of the invoice or quote. It may be desirable to change the filenames the clients see or translate into other languages. Achieve this in the same way as any text within WHMCS, by using the Language Files. Look for these strings:


$_LANG['invoicefilename'] = "Invoice-";
$_LANG['quotefilename'] = "Quote-";

Thanks for the suggestion, but this is not the solution for my question actually 🙂

Link to comment
Share on other sites

2 hours ago, zimbahost said:

Sorry I got it wrong, you need two names in the files, one name when the invoice is open and one when the invoice is paid.

this would be so easy for WHMCS to do. themselves.

2 hours ago, zimbahost said:

Cool this idea also had thinking about it before.

I assume the feature request below was from Mas-J ?

https://requests.whmcs.com/topic/change-proforma-file-name-without-eu-vat-addon

I can think of one potential way to do it with a hook (untested - so it's only theoretical) - but doesn't Kian's Billing Extension rename the filename ?? if so, he'll know how to do this.

Link to comment
Share on other sites

There's no way to do that with standard WHMCS. The first solution that comes to mind is boring but should work.

  1. Use EmailPreSend to detect invoice-related emails and abort sending (you can't handle attachments via API)
  2. Re-create the same email directly including phpMailer class
  3. Download the invoice from dl.php file (Admin authentication required) and store it in a PHP variable (eg. $output = curl_exec($ch);)
  4. Query db to retreive invoice status and anything you want
  5. Name the PDF as you wish like for example "I am Sexy 2020 this invoice is Unpaid You are client ID 120 with USD currency.pdf") bold words come from database
  6. echo $output in that file setting haders (application/pdf)
  7. Attach the newly generated file in th email and send it

As I said it is boring.

Edited by Kian
Link to comment
Share on other sites

14 hours ago, zimbahost said:

Sorry I got it wrong, you need two names in the files, one name when the invoice is open and one when the invoice is paid. Cool this idea also had thinking about it before.

No problem, hehe..

 

10 hours ago, brian! said:

this would be so easy for WHMCS to do. themselves.

I assume the feature request below was from Mas-J ?

https://requests.whmcs.com/topic/change-proforma-file-name-without-eu-vat-addon

I can think of one potential way to do it with a hook (untested - so it's only theoretical) - but doesn't Kian's Billing Extension rename the filename ?? if so, he'll know how to do this.

It's not me, but I've vote for it but I think WHMCS didn't consider it since 2 years ago LoL

 

9 hours ago, Kian said:

There's no way to do that with standard WHMCS. The first solution that comes to mind is boring but should work.

  1. Use EmailPreSend to detect invoice-related emails and abort sending (you can't handle attachments via API)
  2. Re-create the same email directly including phpMailer class
  3. Download the invoice from dl.php file (Admin authentication required) and store it in a PHP variable (eg. $output = curl_exec($ch);)
  4. Query db to retreive invoice status and anything you want
  5. Name the PDF as you wish like for example "I am Sexy 2020 this invoice is Unpaid You are client ID 120 with USD currency.pdf") bold words come from database
  6. echo $output in that file setting haders (application/pdf)
  7. Attach the newly generated file in th email and send it

As I said it is boring.

Cool ! Thanks for the insight, however I can't create the script but I'll give this clue to our dev on other custom modules.

Link to comment
Share on other sites

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated