本文整理汇总了PHP中CRM_Member_BAO_MembershipStatus::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Member_BAO_MembershipStatus::del方法的具体用法?PHP CRM_Member_BAO_MembershipStatus::del怎么用?PHP CRM_Member_BAO_MembershipStatus::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Member_BAO_MembershipStatus
的用法示例。
在下文中一共展示了CRM_Member_BAO_MembershipStatus::del方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDel
public function testDel()
{
$params = array('name' => 'testStatus', 'is_active' => 1);
$membershipStatus = CRM_Member_BAO_MembershipStatus::add($params);
CRM_Member_BAO_MembershipStatus::del($membershipStatus->id);
$defaults = array();
$result = CRM_Member_BAO_MembershipStatus::retrieve($params, $defaults);
$this->assertEquals(empty($result), TRUE, 'Verify membership status record deletion.');
}
示例2: civicrm_api3_membership_status_delete
/**
* Deletes an existing membership status
*
* This API is used for deleting a membership status
*
* @param array Params array containing 'id' - Id of the membership status to be deleted
* {@getfields MembershipStatus_delete}
*
* @return array i
* @access public
*/
function civicrm_api3_membership_status_delete($params)
{
$memberStatusDelete = CRM_Member_BAO_MembershipStatus::del($params['id'], TRUE);
return $memberStatusDelete ? civicrm_api3_create_error($memberStatusDelete['error_message']) : civicrm_api3_create_success();
}
示例3: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
try {
CRM_Member_BAO_MembershipStatus::del($this->_id);
} catch (CRM_Core_Exception $e) {
CRM_Core_Error::statusBounce($e->getMessage(), NULL, ts('Delete Failed'));
}
CRM_Core_Session::setStatus(ts('Selected membership status has been deleted.'), ts('Record Deleted'), 'success');
} else {
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['membershipStatus'] = $this->_id;
}
$oldWeight = NULL;
if ($this->_id) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $this->_id, 'weight', 'id');
}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipStatus', $oldWeight, $params['weight']);
// only for add mode, set label to name.
if ($this->_action & CRM_Core_Action::ADD) {
$params['name'] = $params['label'];
}
$membershipStatus = CRM_Member_BAO_MembershipStatus::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership status \'%1\' has been saved.', array(1 => $membershipStatus->label)), ts('Saved'), 'success');
}
}
示例4: civicrm_membership_status_delete
/**
* Deletes an existing membership status
*
* This API is used for deleting a membership status
*
* @param Int $membershipStatusID Id of the membership status to be deleted
*
* @return null if successfull, object of CRM_Core_Error otherwise
* @access public
*/
function civicrm_membership_status_delete(&$params)
{
if (!is_array($params)) {
return civicrm_create_error('Params is not an array');
}
if (!CRM_Utils_Array::value('id', $params)) {
return civicrm_create_error('Invalid or no value for membershipStatusID');
}
require_once 'CRM/Member/BAO/MembershipStatus.php';
$memberStatusDelete = CRM_Member_BAO_MembershipStatus::del($params['id']);
return $memberStatusDelete ? civicrm_create_error('Error while deleting membership type Status') : civicrm_create_success();
}
示例5: _crm_initialize
/**
* Deletes an existing membership status
*
* This API is used for deleting a membership status
*
* @param Int $membershipStatusID Id of the membership status to be deleted
*
* @return null if successfull, object of CRM_Core_Error otherwise
* @access public
*/
function &crm_delete_membership_status($membershipStatusID)
{
_crm_initialize();
if (empty($membershipStatusID)) {
return _crm_error('Invalid value for membershipStatusID');
}
require_once 'CRM/Member/BAO/MembershipStatus.php';
CRM_Member_BAO_MembershipStatus::del($membershipStatusID);
}
示例6: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
require_once 'CRM/Member/BAO/MembershipStatus.php';
if ($this->_action & CRM_Core_Action::DELETE) {
$wt = CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipStatus', $this->_id);
CRM_Member_BAO_MembershipStatus::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected membership status has been deleted.'));
} else {
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['membershipStatus'] = $this->_id;
}
if ($this->_id) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $this->_id, 'weight', 'id');
}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipStatus', $oldWeight, $params['weight']);
// only for add mode, set label to name.
if ($this->_action & CRM_Core_Action::ADD) {
$params['name'] = $params['label'];
}
$membershipStatus = CRM_Member_BAO_MembershipStatus::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership status \'%1\' has been saved.', array(1 => $membershipStatus->label)));
}
}
示例7: civicrm_api3_membership_status_delete
/**
* Deletes an existing membership status.
*
* This API is used for deleting a membership status
*
* @param array $params
*
* @return array
*/
function civicrm_api3_membership_status_delete($params)
{
$memberStatusDelete = CRM_Member_BAO_MembershipStatus::del($params['id'], TRUE);
if ($memberStatusDelete) {
throw new API_Exception($memberStatusDelete['error_message']);
}
return civicrm_api3_create_success();
}