PDF filename on Pay later contributions is receipt.pdf
Overview
Currently if attach PDF copies to receipts is enabled and a contact completes a "pay later" contribution an email is sent with a pdf named 'receipt.pdf'
As a quick fix it is trivial to detect in CRM/Contribute/BAO/ContributionPage::sendMail whether the payment is pay later or not and use this to change the PDF name.
We also need to check other workflows that trigger pdfs receipts. These look to be CRM/Contribute/BAO/ContributionSoft.php which should be a similar fix to above - and also consider workflows for resending "receipts" where this is hardcoded as well.
Long term this value wouldn't be hard coded in this file but exposed through the UI as either a global setting - or potentially having a per contribution page override.
Additionally as it is currently this is not a translateable string either.
Reproduction steps
- Enable "Attach PDF copy to receipts" via Admin -> System Settings -> Misc
- Create a contribution page with a pay later and payment processor (dummy processor is fine) and add a $1 payment.
- Under the Receipt options -> "Email Receipt to Contributor?" set true.
Current behaviour
When submitting the contribution form with "Pay Later" the email has "Invoice" in the subject - but the attachment filename is "receipt.pdf"
Expected behaviour
When submitting the contribution form with "Pay Later" the email has "Invoice" in the subject - but the attachment filename is "receipt.pdf"
Environment information
- CiviCRM: _Master ( and Current Stable 5.46.2.)