当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Member_BAO_MembershipType::del方法代码示例

本文整理汇总了PHP中CRM_Member_BAO_MembershipType::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Member_BAO_MembershipType::del方法的具体用法?PHP CRM_Member_BAO_MembershipType::del怎么用?PHP CRM_Member_BAO_MembershipType::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Member_BAO_MembershipType的用法示例。


在下文中一共展示了CRM_Member_BAO_MembershipType::del方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 /**
  * Function to process the form
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipType', $this->_id);
         CRM_Member_BAO_MembershipType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'));
     } else {
         $buttonName = $this->controller->getButtonName();
         $submitted = $this->controller->exportValues($this->_name);
         $this->set('searchDone', 0);
         if ($buttonName == '_qf_MembershipType_refresh') {
             $this->search($submitted);
             $this->set('searchDone', 1);
             return;
         }
         $fields = array('name', 'weight', 'is_active', 'member_org', 'visibility', 'period_type', 'minimum_fee', 'description', 'auto_renew', 'autorenewal_msg_id', 'duration_unit', 'renewal_msg_id', 'duration_interval', 'renewal_reminder_day', 'contribution_type_id', 'fixed_period_start_day', 'fixed_period_rollover_day');
         $params = $ids = array();
         foreach ($fields as $fld) {
             $params[$fld] = CRM_Utils_Array::value($fld, $submitted, 'NULL');
         }
         //clean money.
         if ($params['minimum_fee']) {
             $params['minimum_fee'] = CRM_Utils_Rule::cleanMoney($params['minimum_fee']);
         }
         $hasRelTypeVal = FALSE;
         if (!CRM_Utils_System::isNull($submitted['relationship_type_id'])) {
             // To insert relation ids and directions with value separator
             $relTypeDirs = $submitted['relationship_type_id'];
             $relIds = $relDirection = array();
             foreach ($relTypeDirs as $key => $value) {
                 $relationId = explode('_', $value);
                 if (count($relationId) == 3 && is_numeric($relationId[0])) {
                     $relIds[] = $relationId[0];
                     $relDirection[] = $relationId[1] . '_' . $relationId[2];
                 }
             }
             if (!empty($relIds)) {
                 $hasRelTypeVal = TRUE;
                 $params['relationship_type_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relIds);
                 $params['relationship_direction'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relDirection);
             }
         }
         if (!$hasRelTypeVal) {
             $params['relationship_type_id'] = $params['relationship_direction'] = 'NULL';
         }
         if ($params['duration_unit'] == 'lifetime' && empty($params['duration_interval'])) {
             $params['duration_interval'] = 1;
         }
         $config = CRM_Core_Config::singleton();
         $periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
         foreach ($periods as $per) {
             if (CRM_Utils_Array::value('M', $params[$per]) && CRM_Utils_Array::value('d', $params[$per])) {
                 $mon = $params[$per]['M'];
                 $dat = $params[$per]['d'];
                 $mon = $mon < 9 ? '0' . $mon : $mon;
                 $dat = $dat < 9 ? '0' . $dat : $dat;
                 $params[$per] = $mon . $dat;
             } else {
                 $params[$per] = 'NULL';
             }
         }
         $oldWeight = NULL;
         $ids['memberOfContact'] = CRM_Utils_Array::value('contact_check', $submitted);
         if ($this->_id) {
             $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_id, 'weight', 'id');
         }
         $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipType', $oldWeight, $params['weight']);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['membershipType'] = $this->_id;
         }
         $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.', array(1 => $membershipType->name)));
         $session = CRM_Core_Session::singleton();
         if ($buttonName == $this->getButtonName('upload', 'new')) {
             CRM_Core_Session::setStatus(ts(' You can add another membership type.'));
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/member/membershipType', 'action=add&reset=1'));
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:86,代码来源:MembershipType.php

示例2: testdel

 /**
  * check function del()
  *
  */
 public function testdel()
 {
     $ids = array();
     $params = array('name' => 'General', 'description' => NULL, 'minimum_fee' => 100, 'domain_id' => 1, 'duration_unit' => 'year', 'period_type' => 'fixed', 'member_of_contact_id' => $this->_orgContactID, 'duration_interval' => 1, 'financial_type_id' => $this->_financialTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1);
     $membership = CRM_Member_BAO_MembershipType::add($params, $ids);
     $result = CRM_Member_BAO_MembershipType::del($membership->id);
     $this->assertEquals($result, TRUE, 'Verify membership deleted.');
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:12,代码来源:MembershipTypeTest.php

示例3: postProcess

 /**
  * Process the form submission.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         try {
             CRM_Member_BAO_MembershipType::del($this->_id);
         } catch (CRM_Core_Exception $e) {
             CRM_Core_Error::statusBounce($e->getMessage(), NULL, ts('Membership Type Not Deleted'));
         }
         CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'), ts('Record Deleted'), 'success');
     } else {
         $buttonName = $this->controller->getButtonName();
         $submitted = $this->controller->exportValues($this->_name);
         $fields = array('name', 'weight', 'is_active', 'member_of_contact_id', 'visibility', 'period_type', 'minimum_fee', 'description', 'auto_renew', 'duration_unit', 'duration_interval', 'financial_type_id', 'fixed_period_start_day', 'fixed_period_rollover_day', 'month_fixed_period_rollover_day', 'max_related');
         $params = $ids = array();
         foreach ($fields as $fld) {
             $params[$fld] = CRM_Utils_Array::value($fld, $submitted, 'NULL');
         }
         //clean money.
         if ($params['minimum_fee']) {
             $params['minimum_fee'] = CRM_Utils_Rule::cleanMoney($params['minimum_fee']);
         }
         $hasRelTypeVal = FALSE;
         if (!CRM_Utils_System::isNull($submitted['relationship_type_id'])) {
             // To insert relation ids and directions with value separator
             $relTypeDirs = $submitted['relationship_type_id'];
             $relIds = $relDirection = array();
             foreach ($relTypeDirs as $key => $value) {
                 $relationId = explode('_', $value);
                 if (count($relationId) == 3 && is_numeric($relationId[0])) {
                     $relIds[] = $relationId[0];
                     $relDirection[] = $relationId[1] . '_' . $relationId[2];
                 }
             }
             if (!empty($relIds)) {
                 $hasRelTypeVal = TRUE;
                 $params['relationship_type_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relIds);
                 $params['relationship_direction'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relDirection);
             }
         }
         if (!$hasRelTypeVal) {
             $params['relationship_type_id'] = $params['relationship_direction'] = $params['max_related'] = 'NULL';
         }
         if ($params['duration_unit'] == 'lifetime' && empty($params['duration_interval'])) {
             $params['duration_interval'] = 1;
         }
         $periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
         foreach ($periods as $per) {
             if (!empty($params[$per]['M']) && !empty($params[$per]['d'])) {
                 $mon = $params[$per]['M'];
                 $dat = $params[$per]['d'];
                 $mon = $mon < 10 ? '0' . $mon : $mon;
                 $dat = $dat < 10 ? '0' . $dat : $dat;
                 $params[$per] = $mon . $dat;
             } elseif ($per == 'fixed_period_rollover_day' && !empty($params['month_fixed_period_rollover_day'])) {
                 $params['fixed_period_rollover_day'] = $params['month_fixed_period_rollover_day']['d'];
                 unset($params['month_fixed_period_rollover_day']);
             } else {
                 $params[$per] = 'NULL';
             }
         }
         $oldWeight = NULL;
         if ($this->_id) {
             $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_id, 'weight', 'id');
         }
         $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipType', $oldWeight, $params['weight']);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['membershipType'] = $this->_id;
         }
         $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.', array(1 => $membershipType->name)), ts('Saved'), 'success');
         $session = CRM_Core_Session::singleton();
         if ($buttonName == $this->getButtonName('upload', 'new')) {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/member/membershipType/add', 'action=add&reset=1'));
         }
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:82,代码来源:MembershipType.php

示例4: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     require_once 'CRM/Member/BAO/MembershipType.php';
     if ($this->_action & CRM_Core_Action::DELETE) {
         $wt = CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipType', $this->_id);
         CRM_Member_BAO_MembershipType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'));
     } else {
         $params = $ids = array();
         $params = $this->exportValues();
         $this->set('searchDone', 0);
         if (CRM_Utils_Array::value('_qf_MembershipType_refresh', $_POST)) {
             $this->search($params);
             $this->set('searchDone', 1);
             return;
         }
         $params['minimum_fee'] = CRM_Utils_Rule::cleanMoney($params['minimum_fee']);
         if (CRM_Utils_Array::value('relationship_type_id', $params)) {
             $relationId = explode('_', $params['relationship_type_id']);
             $params['relationship_type_id'] = $relationId[0];
             $params['relationship_direction'] = $relationId[1] . '_' . $relationId[2];
         }
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['membershipType'] = $this->_id;
         }
         if ($params['duration_unit'] == 'lifetime' and empty($params['duration_interval'])) {
             $params['duration_interval'] = 1;
         }
         $config =& CRM_Core_Config::singleton();
         $periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
         foreach ($periods as $per) {
             if ($params[$per][$config->dateformatMonthVar] && $params[$per]['d']) {
                 $mon = $params[$per][$config->dateformatMonthVar];
                 $dat = $params[$per]['d'];
                 $mon = $mon < 9 ? '0' . $mon : $mon;
                 $dat = $dat < 9 ? '0' . $dat : $dat;
                 $params[$per] = $mon . $dat;
             } else {
                 $params[$per] = 'null';
             }
         }
         $oldWeight = null;
         $ids['memberOfContact'] = CRM_Utils_Array::value('contact_check', $params);
         if ($this->_id) {
             $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_id, 'weight', 'id');
         }
         $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipType', $oldWeight, $params['weight']);
         $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.', array(1 => $membershipType->name)));
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:57,代码来源:MembershipType.php

示例5: _crm_error

/**
 * Deletes an existing membership type
 * 
 * This API is used for deleting a membership type
 * 
 * @param  Int  $membershipTypeID    ID of membership type to be deleted
 * 
 * @return null if successfull, object of CRM_Core_Error otherwise
 * @access public
 */
function &crm_delete_membership_type($membershipTypeID)
{
    if (!$membershipTypeID) {
        return _crm_error('Invalid value for membershipTypeID');
    }
    require_once 'CRM/Member/BAO/MembershipType.php';
    return CRM_Member_BAO_MembershipType::del($membershipTypeID);
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:18,代码来源:Membership.php

示例6: civicrm_membership_type_delete

/**
 * Deletes an existing membership type
 * 
 * This API is used for deleting a membership type
 * Required parrmeters : id of a membership type
 * 
 * @param  Array   $params  an associative array of name/value property values of civicrm_membership_type
 * 
 * @return boolean        true if success, else false
 * @access public
 */
function civicrm_membership_type_delete(&$params)
{
    if (!is_array($params)) {
        return civicrm_create_error('Params need to be of type array!');
    }
    if (empty($params)) {
        return civicrm_create_error('No input parameters present');
    }
    if (!CRM_Utils_Array::value('id', $params)) {
        return civicrm_create_error('Invalid or no value for membershipTypeID');
    }
    require_once 'CRM/Member/BAO/MembershipType.php';
    $memberDelete = CRM_Member_BAO_MembershipType::del($params['id']);
    return $memberDelete ? civicrm_create_success("Given Membership Type have been deleted") : civicrm_create_error('Error while deleting membership type');
}
开发者ID:ksecor,项目名称:civicrm,代码行数:26,代码来源:MembershipType.php

示例7: civicrm_api3_membership_type_delete

/**
 * Deletes an existing membership type
 *
 * This API is used for deleting a membership type
 * Required parrmeters : id of a membership type
 *
 * @param  Array   $params  an associative array of name/value property values of civicrm_membership_type
 *
 * @return boolean        true if success, else false
 * @access public
 * {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']);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:17,代码来源:MembershipType.php

示例8: testdel

 function testdel()
 {
     $ids = array('memberOfContact' => $this->_orgContactID);
     $params = array('name' => 'General', 'description' => null, 'minimum_fee' => 100, 'duration_unit' => 'year', 'period_type' => 'fixed', 'duration_interval' => 1, 'contribution_type_id' => $this->_contributionTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1);
     $membership = CRM_Member_BAO_MembershipType::add($params, $ids);
     $result = CRM_Member_BAO_MembershipType::del($membership->id);
     $this->assertEquals($result, true, 'Verify membership deleted.');
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:8,代码来源:MembershipTypeTest.php


注:本文中的CRM_Member_BAO_MembershipType::del方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。