X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FMembership.php;h=0f58352e0507cf914f23a9201635837f4cdace11;hb=e68bce7b9d941cb8dbf44bc27ca08571df3a4811;hp=d00ca9fb3d154668dfda0ebfb5372e44e8a7b928;hpb=9ed4c3c05a8b3d0932a18eabe3be878121cb8d19;p=civicrm-core.git diff --git a/api/v3/Membership.php b/api/v3/Membership.php index d00ca9fb3d..0f58352e05 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -112,11 +112,11 @@ function civicrm_api3_membership_create($params) { $action = CRM_Core_Action::ADD; // we need user id during add mode $ids = array (); - if(CRM_Utils_Array::value('contact_id', $params)) { + if (!empty($params['contact_id'])) { $ids['userId'] = $params['contact_id']; } //for edit membership id should be present - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $ids['membership'] = $params['id']; $action = CRM_Core_Action::UPDATE; } @@ -154,7 +154,8 @@ function _civicrm_api3_membership_create_spec(&$params) { 'title' => 'Skip status calculation. By default this is 0 if id is not set and 1 if it is set.' ); $params['num_terms'] = array( - 'title' => 'Number of terms to add/renew. If this parameter is passed, dates will be calculated automatically. If no id is passed (new membership) and no dates are given, num_terms will be assumed to be 1.' + 'title' => 'Number of terms to add/renew. If this parameter is passed, dates will be calculated automatically. If no id is passed (new membership) and no dates are given, num_terms will be assumed to be 1.', + 'type' => CRM_Utils_Type::T_INT, ); } /** @@ -191,7 +192,7 @@ function civicrm_api3_membership_get($params) { } $activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly); - if (CRM_Utils_Array::value('contact_id', $params) && !is_array($params['contact_id'])) { + if (!empty($params['contact_id']) && !is_array($params['contact_id'])) { $membershipValues = _civicrm_api3_membership_get_customv2behaviour($params, $membershipTypeId, $activeOnly ); } else { @@ -249,7 +250,7 @@ function _civicrm_api3_membership_relationsship_get_customv2behaviour(&$params, $membershipValues[$membershipId]['membership_name'] = $membershipType['name']; - if (CRM_Utils_Array::value('relationship_type_id', $membershipType)) { + if (!empty($membershipType['relationship_type_id'])) { $relationships[$membershipType['relationship_type_id']] = $membershipId; }