From: Stan Dragnev Date: Wed, 2 Apr 2014 14:44:53 +0000 (-0400) Subject: CRM-14389 - CiviMember API - Fixes a membership get API regression that caused member... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=324116adb841a69d5a5e87a1e45a2ce348a00795;p=civicrm-core.git CRM-14389 - CiviMember API - Fixes a membership get API regression that caused membership type to be ignored ---------------------------------------- * CRM-14389: http://issues.civicrm.org/jira/browse/CRM-14389 --- diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 360d94685a..3dc3404730 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -192,6 +192,18 @@ function civicrm_api3_membership_get($params) { } $activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly); + //@todo replace this by handling in API layer - we should have enough info to do this + // between pseudoconstant & fk - see comments in format_params + $membershipTypeId = CRM_Utils_Array::value('membership_type_id', $params); + if (!$membershipTypeId) { + $membershipType = CRM_Utils_Array::value('membership_type', $params); + if ($membershipType) { + $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', + $membershipType, 'id', 'name' + ); + } + } + if (CRM_Utils_Array::value('contact_id', $params) && !is_array($params['contact_id'])) { $membershipValues = _civicrm_api3_membership_get_customv2behaviour($params, $membershipTypeId, $activeOnly ); }