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-17647 fix for submitting payment with thousand separator #11539

Merged
merged 2 commits into from
Feb 11, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jan 17, 2018

Overview

Fix for truncation of amount when a payment separator is used

Before

Amount mis-recorded

After

Amount correctly recorded

Technical Details

The general fix for this is to convert amounts ASAP after form submission & not try to handle them in the BAO which does not know if they are already converted

Comments

Unfortunately there are a few places this can happen - we have a way of adding them to unit tests - I replicated one variant from the ticket in a test but not the other.


@eileenmcnaughton
Copy link
Contributor Author

This is failing because I added this line
https://github.com/civicrm/civicrm-core/pull/11539/files#diff-7a5b0e2d131dabc49178460fc63328c0R135

to identify all the other risk places.

We need to grandfather cleaning of money out of CRM_Contribute_BAO_Contribution::create as it should be done on input so we can ensure it ONLY GETS DONE ONCE. Adding a deprecated causes all those places to fail tests. However, it seems in many cases the bad call is from the tests themselves so some cleanup on tests needed as step one

@eileenmcnaughton
Copy link
Contributor Author

note - without the deprecated this could go on 4.7.30 rc

@eileenmcnaughton
Copy link
Contributor Author

Many of the 71 failures represent real bugs of this sort - but some are just the test suite. I added a 'trap' for all cases where the BAO was being allowed to 'clean' money (which should always always happen at the form layer)

We can get rid of a lot of the false positives with #11547 & will need some follow ups but
https://test.civicrm.org/job/CiviCRM-Core-PR/18817/testReport/junit/(root)/CRM_Batch_Form_EntryTest/testProcessMembership/

is an example where we are at risk of messing with our money because it is being cleaned in the BAO whereas it should be only cleaned at the form layer & the BAO should receive 'skipCleanMoney' with a view to switching to removing that from the BAO altogether

@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton
Copy link
Contributor Author

(merged some test-only fixes - let's see how much it dropped by)

@colemanw
Copy link
Member

@eileenmcnaughton now there's only 54 :/

@eileenmcnaughton
Copy link
Contributor Author

#11554 will get rid of a couple more as will #11548 once merged

@eileenmcnaughton
Copy link
Contributor Author

more patches up-merged - let's count again. Also, I got rid of one e-notice scenario

@eileenmcnaughton
Copy link
Contributor Author

down to 32 - 2 real problems that I can see so far

@eileenmcnaughton
Copy link
Contributor Author

test this please

@@ -132,6 +132,7 @@ public static function add(&$params, $ids = array()) {
else {
// @todo put a deprecated here - this should be done in the form layer.
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton if this passes i think we should remove this to do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol

@eileenmcnaughton
Copy link
Contributor Author

21 now - this will clear the next handful #11575

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb I don't expect this to pass yet - but #11575 should be mergeable I think

@monishdeb
Copy link
Member

monishdeb commented Feb 6, 2018

@eileenmcnaughton yup I mentioned the test rebuild command too early :( Well I have merged #11575 and triggered the test build again. Lets see

@eileenmcnaughton
Copy link
Contributor Author

cool

@monishdeb
Copy link
Member

Jenkins test this please

@monishdeb
Copy link
Member

Latest test build shows 13 failures from 21 (-8). Will submit a separate PR for that.

@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb down to 6 fails. (am not working on them at the moment :-)

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb I tested the participant add & the money is appropriately 'clean' by the time it's being processed & I re-applied those minor test fixes. Crossing fingers this passes & we can merge.

NB my money says would could just remove cleanMoney from the BAO now but I guess it won't hurt to go a couple of releases with the deprecation message

@monishdeb
Copy link
Member

@eileenmcnaughton there were 2 test failures which I have fixed now and added my commit in this PR. Hopefully, it will pass now.

@monishdeb
Copy link
Member

Jenkins test this please

@eileenmcnaughton
Copy link
Contributor Author

Test fail unrelated

@eileenmcnaughton eileenmcnaughton merged commit 140d39e into civicrm:master Feb 11, 2018
@eileenmcnaughton eileenmcnaughton deleted the payment branch February 11, 2018 22:10
@mlutfy mlutfy added this to the 4.7.31 milestone Feb 12, 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.

6 participants