-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
[REF] Clean up handling of financial_type_id override #18032
Conversation
(Standard links)
|
633c647
to
dbd0abb
Compare
test this please |
dbd0abb
to
fb513de
Compare
); | ||
'contribution_status_id' => 'Pending', | ||
], $generalParams); | ||
$contributionParams['api.Payment.creaate'] = $contributionParams['total_amount']; |
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.
creaate...
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.
argh - fixed
fb513de
to
e427daf
Compare
@eileenmcnaughton test fail may relate here |
e427daf
to
6ecf323
Compare
test fail related to this line https://github.com/civicrm/civicrm-core/pull/18032/files#diff-40e2e0f106ba620465acf3a9a81f2498R3051 being missing. It has have been the beneficiary of some leakage before this patch |
Currently we use the primaryContributionID to determine whether the templateContribution will have more than one line item & unset the parameter. It makes much more sense to do evaluations on how many line items the template contribution will have when we have loaded it's line items. The logic is that the financial_type_id can be overriden either by editing the recurring contribution (which you are permitted to do if only one line item exists) or by passing it in via input (which is ignored if there is more than one line item. This change ensures the input parameter reaches repeatTrannsaction - which is the appropriate place to determine whether to apply it. It removes one of 2 places that refers to primaryContributionID. The other is also inappropriate as it is basically used to look up the line items to see the number of terms for the membership. However, we already know that for any repeat transactions as we have already loaded the line items. In completeOrder the line items are that of the contribution being saved. We could pass the saved contribution id into this function as a quick way to eliminate the primaryContributionID or we could just determine num_terms rather than primaryContributionID earlier on
6ecf323
to
fa839a6
Compare
@@ -4486,7 +4485,6 @@ public static function completeOrder($input, &$ids, $objects, $transaction = NUL | |||
$changeDate = CRM_Utils_Array::value('trxn_date', $input, date('YmdHis')); | |||
|
|||
$contributionResult = self::repeatTransaction($contribution, $input, $contributionParams); | |||
$contributionParams['financial_type_id'] = $contribution->financial_type_id; |
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.
@mattwire with the other merged I'm just removing the setting & unsetting of $contributionParams['financial_type_id']
Overview
Consolidates handling of calculation as to whether to permit the financial_type_id to be overriden when repeating the transactionn
Before
This is calculated in getTemplateContribution - however there is an additional attempt to calculate it in the main completeOrder function. The calculation is only relevant for repeattransaction & code (which I added comments to) later ensures it is is unset for the complete flow
After
The $input['financial_type_id'] (if any) reaches repeattransaction and all relevant calculations as to whether to permit the override are done in getTemplateContribution
Technical Details
Currently we use the primaryContributionID to determine whether the templateContribution will
have more than one line item & unset the parameter. It makes much more sense to do evaluations
on how many line items the template contribution will have when we have loaded it's line items.
The logic is that the financial_type_id can be overriden either by editing the recurring contribution
(which you are permitted to do if only one line item exists) or by passing it in via input (which
is ignored if there is more than one line item.
This change ensures the input parameter reaches repeatTrannsaction - which is the appropriate
place to determine whether to apply it.
It removes one of 2 places that refers to primaryContributionID. The other is also inappropriate
as it is basically used to look up the line items to see the number of terms for the membership. However,
we already know that for any repeat transactions as we have already loaded the line items. In
completeOrder the line items are that of the contribution being saved.
We could pass the saved contribution id into this function as a quick way to eliminate the primaryContributionID
or we could just determine num_terms rather than primaryContributionID earlier on
Comments