Answers.Body: <p>Let me tell you how I answered my questions above.</p>
  
  <p><em>Why is an online receipt being sent for an offline action?</em></p>
  
  <p>Typically, this sends the <em>right</em> 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.</p>
  
  <p><em>Should I hack the code to use an offline receipt?</em></p>
  
  <p>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.</p>
  
  <p><em>Should I continue using the online receipt but get more data into it?</em></p>
  
  <p>This is the approach I took. I modified the message template for 'contribution_online_receipt' to include at the bottom of the HTML ...</p>
  
  <pre><code>{if !$contributionPageId}
    &lt;no-contribution-page/&gt;
  {/if}
  </code></pre>
  
  <p>... to introduce a HTML element if no Contribution Page was supplied.</p>
  
  <p>My implementation of hook_civicrm_alterMailParams() looks for this element, and if found replaces it with the details I want ...</p>
  
  <ul>
  <li>Financial Type</li>
  <li>Receipt Date</li>
  <li>Paid By <em>(instrument)</em></li>
  <li>Custom fields that have visibility 'Public pages' <em>(eg, we want to show people details like 'donation purpose' but not 'internal category X')</em></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T04:57:07.047Z
Answers.LastActivityDate: 2015-08-26T04:57:07.047Z
Answers.UserDisplayName: Ken West
Body: <p>In our situation we upload contributions into CiviCRM and want to send a receipt.</p>
  
  <p>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!</p>
  
  <p>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.</p>
  
  <p>So, why is an online receipt being sent for an offline action?</p>
  
  <p>To fix this should I continue using the online receipt but get more data into it?</p>
  
  <p>Or should I hack the code to use an offline receipt?</p>
  
  <p>Thoughts appreciated!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-24T02:38:39.233Z
Comments.Text: Clue: the author of CRM_Contribute_Form_Task_PDF wrote "set some fake input values so we can reuse IPN code" on line 181.
Comments.UserDisplayName: Ken West
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-24T03:46:37.063Z
Comments.Text: 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.
Comments.UserDisplayName: Ken West
Tags: <civicontribute>
Title: Why is offline contribution sending an online receipt?
ThreadText: # Why is offline contribution sending an online receipt?
  
  (Asked by: username_0 on 2015-08-24)
  
  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!
  
  **Tags:** civicontribute
  
  > **Comments:**
  > **username_0**: Clue: the author of CRM_Contribute_Form_Task_PDF wrote "set some fake input values so we can reuse IPN code" on line 181.  
  > **username_0**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-08-26. Score: 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}
    
  {/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')
  
  
  ---
  
  