-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
Partial refactor of completeMembershipFromContribution #12271
Conversation
@@ -2441,7 +2441,7 @@ public function loadRelatedObjects(&$input, &$ids, $loadAll = FALSE) { | |||
} | |||
} | |||
|
|||
$this->loadRelatedMembershipObjects($ids); | |||
$ids = $this->loadRelatedMembershipObjects($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.
just ditching pass-by-param here
$trxnsData['trxn_date'] | ||
); | ||
} | ||
self::updateMembershipBasedOnCompletionOfContribution( |
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.
pretty much per Matt's - load relatedObjects in updateMembershipBasedOnCompletionOfContribution & do early return in there too
@@ -4598,10 +4594,6 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re | |||
self::repeatTransaction($contribution, $input, $contributionParams, $paymentProcessorId); | |||
$contributionParams['financial_type_id'] = $contribution->financial_type_id; | |||
|
|||
if (is_numeric($memberships)) { |
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.
memberships is defined as
$memberships = CRM_Utils_Array::value('membership', $objects);
so that line is meaningless
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.
& actually - $memberships not used anyway
); | ||
} | ||
self::updateMembershipBasedOnCompletionOfContribution( | ||
$contribution, |
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.
no memberships param
0350a5e
to
46400cc
Compare
46400cc
to
bbb16fe
Compare
bbb16fe
to
e6c7e48
Compare
this is good to merge from my side @eileenmcnaughton |
OK - let's do this & then next round can have some tests! Merging |
Overview
This is a partial of #11556 - it contains part of that code tidy up
Before
Code less maintainable
After
Code more maintainable
Technical Details
@omarabuhussein I took a look at #11556 as we were discussing and this is about the size chunk I feel comfortable reviewing / merging .... and which I feel comfortable makes sense after reviewing the code myself
It moves the loading of related membership objects to the function that @mattwire has reworked - without actually changing it to an array as Matt does or changing the processing. I took a look at the paths by which updateMembershipBasedOnCompletionOfContribution is reached and I feel pretty comfortable it is equivalent to the result of $contributionDAO->loadRelatedMembershipObjects(); in all cases - that is the main change in here. I'm not too worried about the performance impact of potentially loading that twice. I don't think it's much in the scheme of things. If you feel comfortable with this portion we can merge it & get @mattwire to rebase the larger PR
Comments