/** * check method del() */ function testdel() { $params = array('name' => 'Donations', 'is_deductible' => 0, 'is_active' => 1); $ids = array(); $contributionType = CRM_Contribute_BAO_ContributionType::add($params, $ids); CRM_Contribute_BAO_ContributionType::del($contributionType->id); $params = array('id' => $contributionType->id); $result = CRM_Contribute_BAO_ContributionType::retrieve($params, $defaults); $this->assertEquals(empty($result), true, 'Verify contribution types record deletion.'); }
/** * Function to process the form * * @access public * * @return None */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { CRM_Contribute_BAO_ContributionType::del($this->_id); CRM_Core_Session::setStatus(ts('Selected contribution type 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['contributionType'] = $this->_id; } $contributionType = CRM_Contribute_BAO_ContributionType::add($params, $ids); CRM_Core_Session::setStatus(ts('The contribution type \'%1\' has been saved.', array(1 => $contributionType->name))); } }
/** * Function to process the form * * @access public * @return None */ function postProcess() { require_once 'CRM/Contribute/BAO/ContributionType.php'; if ($this->_action & CRM_CORE_ACTION_DELETE) { CRM_Contribute_BAO_ContributionType::del($this->_id); CRM_Core_Session::setStatus(ts('Selected contribution type 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['contributionType'] = $this->_id; } $contributionType = CRM_Contribute_BAO_ContributionType::add($params, $ids); CRM_Core_Session::setStatus(ts('The contribution type "%1" has been saved.', array(1 => $contributionType->name))); } }
/** * Function to delete contribution Types * * @param int $contributionTypeId */ function contributionTypeDelete($contributionTypeID) { require_once 'CRM/Contribute/BAO/ContributionType.php'; $del = CRM_Contribute_BAO_ContributionType::del($contributionTypeID); }