-
-
Notifications
You must be signed in to change notification settings - Fork 828
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-21216 Replace member_BAO_membershiptype_getMembershipTypesByOrg with API eq… #11020
CRM-21216 Replace member_BAO_membershiptype_getMembershipTypesByOrg with API eq… #11020
Conversation
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.
I like the changes here, I haven't tested them but the code looks correct to me. @eileenmcnaughton Eileen any thoughts?
In order to test this I put the following code
into the existing getMembershipTypesByOrg function & ran the tests identified in this PR - they still passed. I am going to merge this as the code looks good & I believe the tests adequately cover it. But I wonder if we shouldn't change the function to be more deprected ie change the function to
|
@@ -849,8 +849,10 @@ public static function getContactMembership($contactID, $memType, $isTest, $memb | |||
$params = array('id' => $memType); | |||
$membershipType = array(); | |||
if (CRM_Member_BAO_MembershipType::retrieve($params, $membershipType)) { | |||
$memberTypesSameParentOrg = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($membershipType['member_of_contact_id']); | |||
$memberTypesSameParentOrgList = implode(',', array_keys($memberTypesSameParentOrg)); | |||
$memberTypesSameParentOrg = civicrm_api3('MembershipType', 'get', array( |
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.
This does look like it will run into problems when there are more than 25 membership types due to API requests having a default limit of 25 values.
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.
arg true!
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 did you see that comment?
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.
:-( Please see new PR #11029 that fixes this and also updates deprecated function based on your comments @eileenmcnaughton @tschuettler
…uivalent
Overview
Replace the BAO function getMembershipTypesByOrg with generic API function.
Before
Custom code that does the same as the API
After
Generic API is used to retrieve the same information in the same format.
Technical Details
The API supports the necessary parameters to retrieve the information that is being retrieved by the custom function.