-
-
Notifications
You must be signed in to change notification settings - Fork 824
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 ContributionForm to use skipCleanMoney on update & upda… #11575
CRM-17647 fix ContributionForm to use skipCleanMoney on update & upda… #11575
Conversation
@@ -1040,7 +1040,7 @@ public static function processContribution( | |||
|
|||
$contribParams['skipLineItem'] = 1; | |||
// create contribution record | |||
$contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ids is empty & deprecated
@@ -1636,7 +1632,7 @@ protected function submit($submittedValues, $action, $pledgePaymentID) { | |||
if (!empty($params['note']) && !empty($submittedValues['note'])) { | |||
unset($params['note']); | |||
} | |||
$contribution = CRM_Contribute_BAO_Contribution::create($params, $ids); | |||
$contribution = CRM_Contribute_BAO_Contribution::create($params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ids is deprecated & we have $params['id'] set
35a7090
to
7637daa
Compare
jenkins, test this please |
…te tests to cover
3dd3242
to
66ea983
Compare
@monishdeb are you able to review this? Am trying to get instances of 'BAO is called without skipCleanMoney' down to zero so we can deprecate & remove the (unreliable) BAO-cleaning - per #11539 |
I have tested the patch in my local and fixes are straighforward, doesn't cause any unintended regression. Changes in unit-tests makes sense. Happy with this patch, merging now. |
thanks! |
Overview
As part of resolving issues around currency separators this PR adds tests to submitting the contribution form in update mode. Identified instances of mis-recording amounts have been fixed but there may well be more & we need to fix the underlying issue.
Before
tests don't cover both separator variants, BAO is cleaning the values when they should be & are being cleaned in the form
After
Additional tests. BAO not being permitted to cleanMoney
Technical Details
The underlying issue is the attempt to 'cleanMoney' in the Contribution_BAO is unreliable. At some point it was determined that money might have already been cleaned before this point (true) & some unreliable extra handling was added (bad).
To get back to reliability around handling numbers with a thousand separator we need to
a) make sure that all core places in code that call Contribute_BAO_Contribution::create pass 'skipCleanMoney' (the api already does)
b) add a deprecation notice so that any code that calls it without skipCleanMoney gets a notice for a few versions
c) remove cleaning money from the contribution BAO.
Comments
#11539 has tests identifying where the BAO is being allowed to attempt to clean money