API method to get data from the declaration that corresponds to a contribution
As part of #16 (closed), I wrote an API method: getcontributioneligibility
that facilitates reading fields from the declaration that corresponds to a contribution. There is already a merge request associated: !17 (merged).
Usage Example
The main use case of the new API method is to be able to add information from the Gift Aid declaration that corresponds to a contribution, when designing a receipt template. The goal is to write templates that can be used to both print receipts for new contributions or reprint them for old ones.
{crmAPI var='contribution_giftaid_declaration' entity='GiftAid' action='getcontributioneligibility'
sequential=0 contribution_id=$contributionID}
{crmAPI var='contribution_eligible' entity='OptionValue' action='get'
sequential=1 return='label' value=$contribution_giftaid_declaration.values.eligible_for_gift_aid
option_group_id='eligibility_declaration_options'}
{assign var='eligible' value=$contribution_eligible.values.0.label}
{if isset($eligible)}
<tr>
<td {$labelStyle}>
{ts}Eligible for Gift Aid?{/ts}
</td>
<td {$valueStyle}>
{$eligible}
</td>
</tr>
{/if}
Edited by capo