3

In our situation we upload contributions into CiviCRM and want to send a receipt.

If we upload a set of contributions, find them using Find Contributions and then edit each one, we can tick "send receipt" and the donor is sent an offline receipt with lots of useful data. Yay!

But it's a hassle editing each one. We want to use the action Send Receipt. But this sends an online receipt with much less detail.

So, why is an online receipt being sent for an offline action?

To fix this should I continue using the online receipt but get more data into it?

Or should I hack the code to use an offline receipt?

Thoughts appreciated!

  • Clue: the author of CRM_Contribute_Form_Task_PDF wrote "set some fake input values so we can reuse IPN code" on line 181. – Ken West Aug 24 '15 at 2:38
  • Clue: CRM_Core_Payment_BaseIPN->sendMail() calls CRM_Contribute_BAO_Contribution::composeMessageArray() which in turn calls CRM_Contribute_BAO_ContributionPage::sendMail(). So there's an assumption that a Contribution Page is involved. – Ken West Aug 24 '15 at 3:46
1

Let me tell you how I answered my questions above.

Why is an online receipt being sent for an offline action?

Typically, this sends the right receipt, as the original action was taken online. However, when the contact makes an EFT contribution, and it is uploaded to CiviCRM, there is no online action (not involving CiviCRM, anyway). So in this case the use of an online receipt introduces the wrinkle that there is no Contribution Page or Event Registration Page, and no Line Items. So details that the online receipt is expecting are missing.

Should I hack the code to use an offline receipt?

For me, no. The workflows in the code were a bit too different for me to easily resolve/refactor. That would be a major project in its own right.

Should I continue using the online receipt but get more data into it?

This is the approach I took. I modified the message template for 'contribution_online_receipt' to include at the bottom of the HTML ...

{if !$contributionPageId}
  <no-contribution-page/>
{/if}

... to introduce a HTML element if no Contribution Page was supplied.

My implementation of hook_civicrm_alterMailParams() looks for this element, and if found replaces it with the details I want ...

  • Financial Type
  • Receipt Date
  • Paid By (instrument)
  • Custom fields that have visibility 'Public pages' (eg, we want to show people details like 'donation purpose' but not 'internal category X')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.