I added specific code to the further explain
Source Link
RayWright
  • 2.3k
  • 7
  • 24

Being able to group Thank You Letters by contact is a great feature for both everyday receipts (we have a company that will donate via multiple smaller donations at once) and end of the year receipts.

But I'm running into a problem, if I add either a custom token I set up (adding to Eileen's extension civitoken) or use an if statement around a contribution token, the token no longer loops for each contribution printed. For example:

{crmAPI var='contresult' entity='Contribution' action='get' sequential=0 id=$note_id}
 {foreach from=$contresult.values item=contribution}
  {if $contribution.non_deductible_amount gt 0}${$contribution.non_deductible_amount}{else}N/A{/if}
 {/foreach}

WhatThe function doesn't display anything when I mean is the date and amount of each contribution but the custom token'group by' (If I wroterun a thank you letter for a single contribution noteit does notwork. Also)

In this example:

{capture assign='note_id'}{contribution.contribution_id}{/capture}
{crmAPI var='result' entity='Note' action='get' sequential=0 entity_table="civicrm_contribution" entity_id=$note_id}
 {assign var='note_count' value=$result.count}
  {if !$note_count}None{elseif $note_count}
   {foreach from=$result.values item=note}{$note.note}{/foreach}
  {/if} 

It only returns "None" once, when the if statement I wrote to show N/A if there is no 'non-deductible-amount' doesn't run atcontributions all if I group thank you letters by contacthave notes.

How can I use either custom tokens or anmake the if statement inside arun for each of the contributions selected for the thank you letter with multiple contributions listed?

Being able to group Thank You Letters by contact is a great feature for both everyday receipts (we have a company that will donate via multiple smaller donations at once) and end of the year receipts.

But I'm running into a problem, if I add either a custom token I set up (adding to Eileen's extension civitoken) or use an if statement around a contribution token, the token no longer loops for each contribution printed.

What I mean is the date and amount of each contribution but the custom token I wrote for a contribution note does not. Also the if statement I wrote to show N/A if there is no 'non-deductible-amount' doesn't run at all if I group thank you letters by contact.

How can I use either custom tokens or an if statement inside a thank you letter with multiple contributions listed?

Being able to group Thank You Letters by contact is a great feature for both everyday receipts (we have a company that will donate via multiple smaller donations at once) and end of the year receipts.

But I'm running into a problem, if I use an if statement around a contribution token, the token no longer loops for each contribution printed. For example:

{crmAPI var='contresult' entity='Contribution' action='get' sequential=0 id=$note_id}
 {foreach from=$contresult.values item=contribution}
  {if $contribution.non_deductible_amount gt 0}${$contribution.non_deductible_amount}{else}N/A{/if}
 {/foreach}

The function doesn't display anything when I 'group by' (If I run a thank you letter for a single contribution it does work.)

In this example:

{capture assign='note_id'}{contribution.contribution_id}{/capture}
{crmAPI var='result' entity='Note' action='get' sequential=0 entity_table="civicrm_contribution" entity_id=$note_id}
 {assign var='note_count' value=$result.count}
  {if !$note_count}None{elseif $note_count}
   {foreach from=$result.values item=note}{$note.note}{/foreach}
  {/if} 

It only returns "None" once, when the contributions all have notes.

How can I make the if statement run for each of the contributions selected for the thank you letter?

Source Link
RayWright
  • 2.3k
  • 7
  • 24

How can I use custom tokens when grouping Thank You letters

Being able to group Thank You Letters by contact is a great feature for both everyday receipts (we have a company that will donate via multiple smaller donations at once) and end of the year receipts.

But I'm running into a problem, if I add either a custom token I set up (adding to Eileen's extension civitoken) or use an if statement around a contribution token, the token no longer loops for each contribution printed.

What I mean is the date and amount of each contribution but the custom token I wrote for a contribution note does not. Also the if statement I wrote to show N/A if there is no 'non-deductible-amount' doesn't run at all if I group thank you letters by contact.

How can I use either custom tokens or an if statement inside a thank you letter with multiple contributions listed?