Blank Invoice.pdf attached when not needed
Overview
When the option to send email invoices is turned on, if the workflow sending the invoice doesn't have an associated contribution, e.g. when registering a participant for an unpaid event, an Invoice.pdf is attached containing a single blank page.
It's been reported on SE: https://civicrm.stackexchange.com/questions/41933/how-can-i-stop-blank-invoices-being-sent-out-with-confirmation-emails-for-non-pa
Reproduction steps
- Execute one of the workflows that sends an invoice, in such a way that doesn't generate a contribution. Relevant workflows are Contribution/Event/Membership Online/Offline Receipt.
- Check email for Invoice.pdf. It will be blank.
Current behaviour
User receives an email with a blank invoice attached, and gets confused.
Expected behaviour
No contribution, no invoice attached, user not confused.
Comments
no-blank-invoice.diff is probably the simplest solution. Another option would be to find everywhere isEmailPdf
is set (half dozen files), and then add logic to make sure there's a contribution before setting it.