X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FMembershipType.php;h=42d4f94001a51781d44a105c1207032ba94fcace;hb=1b1931152a86683bd792c6103f9ac8fb0c0bb3ad;hp=a2312fd956ce3329bc4d27ad2f56834f5c206a50;hpb=6fadc78feb6e82b248b4b32d490f8f45a140a51a;p=civicrm-core.git diff --git a/api/v3/MembershipType.php b/api/v3/MembershipType.php index a2312fd956..42d4f94001 100644 --- a/api/v3/MembershipType.php +++ b/api/v3/MembershipType.php @@ -95,6 +95,25 @@ function civicrm_api3_membership_type_get($params) { return $results; } +/** + * Adjust input for getlist action. + * + * We want to only return active membership types for getlist. It's a bit + * arguable whether this should be applied at the 'get' level but, since it's hard + * to unset we'll just do it here. + * + * The usage of getlist is entity-reference fields & the like + * so using only active ones makes sense. + * + * @param array $request + * Array of parameters determined by getfields. + */ +function _civicrm_api3_membership_type_getlist_params(&$request) { + if (!isset($request['params']['is_active'])) { + $request['params']['is_active'] = 1; + } +} + /** * Deletes an existing membership type. *