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-21698 Format amount #11577

Merged
merged 1 commit into from
Jan 23, 2018
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jan 23, 2018

Overview

Fix intermittent mis-recording on negative contributions.

Before

On some systems recording a negative contribution results in a $0 contribution due to an earlier 'mis-fix' - #5767.

The testEnterNegativeContribution fails locally for me. When I add thousandSeparator testing testSubmitContributionPageWithPriceSet passes locally & fails remotely

After

locally the test & UI submission work for negative amounts & on testSubmitContributionPageWithPriceSet

Technical Details

The correct place to clean money is on submission & the correct place to format it is immediately prior to use. It was being formatted deep in the BAO - this moves it to the processor class.

Comments

@mattwire @adixon I think we should do this small fix rather than hang off for the big fix discussed on CRM-16460 - if we do a bigger fix we can call it from this function

Payment processor writers that rely on this code may need to ensure they are formatting the amounts or using the new function. Omnipay, IATS are not affected



@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton eileenmcnaughton changed the title Format amount CRM-21698 Format amount Jan 23, 2018
This moves the fix for CRM-16460 to the processor class, providing a helper function.

The fix put number formatting deep into the BAO - when they don't work right
(depending on presence of money_format function I think) negative amounts
become 0
@adixon
Copy link
Contributor

adixon commented Jan 23, 2018

Thanks, this looks right.

@colemanw colemanw merged commit 739a792 into civicrm:master Jan 23, 2018
@colemanw
Copy link
Member

Code looks good. Merging based on review & passing tests.

@eileenmcnaughton eileenmcnaughton deleted the format_amount branch January 23, 2018 19:37
@KarinG
Copy link
Contributor

KarinG commented Jan 24, 2018

Awesome - thank you.

@mattwire
Copy link
Contributor

👍

@mlutfy mlutfy added this to the 4.7.31 milestone Feb 9, 2018
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.

7 participants