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

CRM-19937 - ensure amount preceded by $ is still treated as a number #9745

Merged
merged 2 commits into from
Feb 28, 2017

Conversation

jmcclelland
Copy link
Contributor

@jmcclelland jmcclelland commented Jan 27, 2017

otherwise the payment fields will not be shown.
@MegaphoneJon
Copy link
Contributor

MegaphoneJon commented Jan 27, 2017 via email

@jmcclelland
Copy link
Contributor Author

I'm not sure how to test for any currency symbol... but we could test if the first character is not a number and if so strip it off and test the rest of the string to see if it's a number.

@@ -150,7 +150,8 @@ function calculateSelectLineItemValue(priceElement) {
*/
function calculateText(priceElement) {
//CRM-16034 - comma acts as decimal in price set text pricing
var textval = parseFloat(cj(priceElement).val().replace(thousandMarker, ''));
//CRM-19937 - dollar sign easy mistake to make by users.
var textval = parseFloat(cj(priceElement).val().replace(thousandMarker, '').replace('$', ''));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmcclelland I see we already have currency symbol in a symbol variable as we have for thousandMarker. We should be able to replace the same using:

.replace(thousandMarker, '').replace(symbol, ''));

Can you please try this and check if it works for you ?

Thanks.

@jmcclelland
Copy link
Contributor Author

Ah... symbol - didn't see that. Great idea. I just made the change.

Copy link
Contributor

@jitendrapurohit jitendrapurohit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works fine.

@eileenmcnaughton
Copy link
Contributor

Based on the review above and my own reading of the code I think this is good to merge

@eileenmcnaughton eileenmcnaughton merged commit f832e5e into civicrm:master Feb 28, 2017
monishdeb pushed a commit to monishdeb/civicrm-core that referenced this pull request May 2, 2017
CRM-19937 - ensure amount preceded by $ is still treated as a number
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.

5 participants