1

using: CDN Tax Receipts Extension https://github.com/jake-mw/CDNTaxReceipts

1 Answer 1

2

The CDN Tax Receipts extension contains several hooks - one of them allows you to set the 'method' of delivery (Email vs Print) for a specific Contact. Here's an example implementation:

/**
 * Determine Contact's Preferred Communication Method
 * return 'print' -> if Postal Mail is checked
 */
function my_receipts_cdntaxreceipts_method($contactId) {

  // Check if Contact's Preferred Communication Method = Postal Mail -> id = 3
  $result_pcm_id = civicrm_api3('Contact', 'get', array(
    'return' => "preferred_communication_method",
    'id' => $contactId,
  ));

  if ($result_pcm_id['is_error'] != 1) {
    if (count($result_pcm_id['values'][$contactId]['preferred_communication_method']) == 1) {
      if ($result_pcm_id['values'][$contactId]['preferred_communication_method'][0] == 3) {
        return array('print');
      }
    }
  }
}

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.