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

crmMoney filter - allow coercing locale #26383

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

MegaphoneJon
Copy link
Contributor

Overview

This adds a crmMoney filter to tokens, comparable to crmDate, for coercing money into a particular format.

Before

You couldn't force money to render a particular way in a message template.

After

Now you can.

Comments

This needs documentation, which I'll do when this is merge-ready.

Slightly out of scope, but there's a not in Civi/Token/TokenProcessor that says // TODO: Move this to StandardFilters. This doesn't quite work, but with a bit of tweaking, that if block can be removed from TokenProcessor.

@civibot
Copy link

civibot bot commented May 30, 2023

(Standard links)

@civibot civibot bot added the master label May 30, 2023
@eileenmcnaughton
Copy link
Contributor

@MegaphoneJon this feature already exists - check testContributionRecurTokenRaw (which failed here)

Which field is it not working for you on?

@MegaphoneJon
Copy link
Contributor Author

I'll look tomorrow where it failed for me - I still think the ability to coerce a particular l10n is valuable, though if folks disagree I could put it in an extension.

I need to file a separate bug report, but at least on the master branch, "Amount" is appearing in the token browser when creating a letter on contributions, but it refers to the contribution_recur.amount.

@eileenmcnaughton
Copy link
Contributor

@MegaphoneJon yeah that amount IS a field that COULD be available to contributions - but is obviously confused with total_amount very easily

I think there might be another PR @samuelsov put up (open or closed?) adding language to the crmMoney function somewhere

@MegaphoneJon MegaphoneJon changed the title crmMoney filter crmMoney filter - allow coercing locale Jun 16, 2023
@eileenmcnaughton
Copy link
Contributor

I'm merging this because it is consisent with the smarty function which seems to be our goal.

But just noting that we have some other fixes in the same release that deal with money & locale & remove the need for this when using workflow message translations (I hope)

@eileenmcnaughton eileenmcnaughton merged commit dc665a9 into civicrm:master Jun 27, 2023
@eileenmcnaughton
Copy link
Contributor

@MegaphoneJon I think you were going to document as a follow up? I think we might be either seriously out of date with or entirely missing documentation on token filters.....

@MegaphoneJon
Copy link
Contributor Author

It's true, the best documentation is a Stack Exchange post I made - which is good, because I probably reference it more than anyone.

I'll get some docs started.

@MegaphoneJon MegaphoneJon deleted the crmmoney-filter branch June 27, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants