-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
dev/core#3059 Regression fix - be tolerant with smarty money #22727
Conversation
I've seen issues in extended reports and in core where already-formatted money from custom fields is formatted again in the smarty layer and, with recent changes , throwing an exception when the money is greater than 1000 (because the presence of a comma makes it invalid). This adds tolerance that seems consistent with prior code
(Standard links)
|
Attempt to tackle root cause in view pages #22728 |
It only seems to come up on contributions, so I'm just trying to figure out if this is the right fix. For non-us, the error does come up for smaller values but again only on contributions. (Sidenote: For non-us it comes up even if you don't fill in a value, because it then tries to format |
@demeritcowboy hmm - that's interesting! I do think formatting at the tpl layer (only) is the right fix probably |
@demeritcowboy I think your comment was intended for #22728 & not this PR? |
So I did some I compared the behavior to 5.45 (default locale=fr_FR, default currency=EUR, thousands='.', decimal=','): Here's #22727 (this PR; fixes crash; missing currency symbol; fixes separators): And here's #22728 (fixes crash; has symbol; fixes separators): So I can confirm that the present (generic) patch does mitigate the biggest problem (the crash), and it makes sense that it would mitigate across more use-cases. But the narrower #22728 does give a better outcome (for this specific screen). Would it be crazy to put both patches (#22727, #22728) on both branches (5.46,5.47)? |
Definitely an improvement. Since the r-run is fine, I'll merge. Other fixes can be done as additional PRs. |
Overview
To replicate - create a custom field of type money - mine was against entity contribution.
Create a contribution (or whatever) with the field and give it a value greater than 1000.
Attempt to view - fatal error
Before
After
Loads
Technical Details
The issue is the php layer is formatting it to money -and the smarty does so again. By the second time a value > 999 is no longer valid (in US locale) and it fatals. I would expect this to be a problem in European locales for smaller values.
The fix makes seems comparible with the prior laxity. I have also already done an extended reports release which fixes the source issue in reports (ie formats only once...)
Comments