Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional available tokens for the receipt: campaign, payment method #194

Open
Guydn opened this issue Apr 14, 2024 · 10 comments
Open

Additional available tokens for the receipt: campaign, payment method #194

Guydn opened this issue Apr 14, 2024 · 10 comments

Comments

@Guydn
Copy link

Guydn commented Apr 14, 2024

For the french receipt, we need to display the payment method label (check, transfer, credit card) in the receipt.

In case of donation for a specific purpose (campaign/ project label), it is useful to give the donor an information in the receipt. That can be in single or in bulk receipts.

Are these tokens available now ? If not which effort would be needed to have them ?

@jensschuppe
Copy link
Collaborator

These tokens currently do not seem to be available, but might be easy to add to the queries that collect all the data. We will have to double-check, however, if they affect the storage of receipts (as they'll have to be statically saved so that future copies won't differ from the original). Also, the code fetching things from the DB looks quite old, so that while adding functionality, refactoring might make sense.

There is also a hook being invoked when evaluating tokens (hook_civicrm_donationReceiptTokenValues()) which you could implement for providing values for more tokens. I can't find an example though, but the values provided by that hook are being passed to the template.

@Guydn
Copy link
Author

Guydn commented Apr 16, 2024

Thanks a lot for replying ! For the first option what would be the development effort to sponsor ?

@bjendres
Copy link
Member

Hi @Guydn. There might be another option: You should be able to load the payment method label during the PDF generation via SMARTY. Let us know if you need help with that.

However, this approach would have one drawback: the receipts are supposed to be immutable, but in this case a change in the payment method would not be stored in the receipt DB entry - for that this structure would have to be extended, which would require quite some work - that's what my colleague was referring to.

But if you're ok with this drawback, and/or you use the "Store the original PDF file" option, then the SMARY approach might be "good enough" for you.

@Guydn
Copy link
Author

Guydn commented Apr 19, 2024

Thanks a lot @bjendres I will try this solution. Maybe we can close this issue for the time being.

@wyde22
Copy link

wyde22 commented May 14, 2024

Hi @bjendres ,

i want to customize a profile for generate a receipt for my use case.

in the template of profile i want to add the name of campaign and the method payment. In my template i have this object $items

with this object i can use a foreach like this :

{foreach from=$items item=item}
<table style="text-align: center;" width="100%" align="center">
    <tbody>
        <tr>
            <td width="33.3333%">
                <p
                    style="text-align: right; color: #00577b; font-family: Roboto, Helvetica, sans-serif; font-weight: 400; font-size: 12px;">
                    {$item.receive_date|date_format:"%d-%m-%Y"}</p>
            </td>
            <td width="33.3333%">
                <p
                    style="text-align: center; color: #00577b; font-family: Roboto, Helvetica, sans-serif; font-weight: 400; font-size: 12px;">
                    {$item.financial_type}</p>
            </td>
            <td width="33.3333%">
                <p
                    style="text-align: left; color: #ea148c; font-family: Roboto, Helvetica, sans-serif; font-weight: 400; font-size: 12px;">
                    {$item.total_amount|crmMoney:EUR}</p>
            </td>
        </tr>
    </tbody>
</table>
{/foreach}

in this HTML table i can retrieve information of contribution with bulk option (directly on tab option of contact). Perfect !!

now i want to add in my HTML table another information : method payment and the name of campaign. I have difficulties to retrieve this information. I tested this token in my template but without results : {$item.payment_method}, {$item.campaign}

For the test i display an identifiant of this $item. Here the token for display this identifiant : {$item.id}. But this value is not an identifiant in entity of civicrm like Contribution. I don't find this information in my database. Where is this identifiant in the crm database ?

How can retrieve name of campaign and method payment in my template ?

Thanks

@wyde22
Copy link

wyde22 commented May 27, 2024

Hi @jensschuppe or @bjendres have you got an idea for my problem please ?

thanks

@Guydn
Copy link
Author

Guydn commented Jun 24, 2024

Hello @bjendres , If it can help, I am ok to fund the dev effort either by helping @wyde22 or by implementing it in Donrec. Let me know :-).

@peth-systopia
Copy link
Contributor

Hi @Guydn, thanks for offering your help. To discuss details and get a quote, could you email us at [email protected]?

@peth-systopia
Copy link
Contributor

internal ref #25568

@jonathandhn
Copy link

Hi any news on this or to display the received date for single receipt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants