<?php
-// $Id$
/*
+--------------------------------------------------------------------+
*
*/
-/**
- * Files required for this package
- */
-require_once 'CRM/Member/BAO/MembershipType.php';
-
/**
* API to Create or update a Membership Type
*
* {getfields MembershipType_get}
*/
function civicrm_api3_membership_type_create($params) {
-
$values = $params;
civicrm_api3_verify_mandatory($values, 'CRM_Member_DAO_MembershipType');
$ids['memberOfContact'] = CRM_Utils_Array::value('member_of_contact_id', $values);
$ids['contributionType'] = CRM_Utils_Array::value('financial_type_id', $values);
- require_once 'CRM/Member/BAO/MembershipType.php';
$membershipTypeBAO = CRM_Member_BAO_MembershipType::add($values, $ids);
$membershipType = array();
_civicrm_api3_object_to_array($membershipTypeBAO, $membershipType[$membershipTypeBAO->id]);
CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
return civicrm_api3_create_success($membershipType, $params, 'membership_type', 'create', $membershipTypeBAO);
}
-/*
+
+/**
* Adjust Metadata for Create action
- *
+ *
* The metadata is used for setting defaults, documentation & validation
* @param array $params array or parameters determined by getfields
*/
* @access public
*/
function civicrm_api3_membership_type_get($params) {
-
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
* {getfields MembershipType_delete}
*/
function civicrm_api3_membership_type_delete($params) {
-
-
$memberDelete = CRM_Member_BAO_MembershipType::del($params['id'], 1);
return $memberDelete ? civicrm_api3_create_success($memberDelete) : civicrm_api3_create_error('Error while deleting membership type. id : ' . $params['id']);
}