/** * Check method del() */ public function testdel() { $params = array('name' => 'Donations', 'is_deductible' => 0, 'is_active' => 1); $ids = array(); $contributionType = CRM_Financial_BAO_FinancialAccount::add($params, $ids); CRM_Financial_BAO_FinancialAccount::del($contributionType->id); $params = array('id' => $contributionType->id); $result = CRM_Financial_BAO_FinancialAccount::retrieve($params, $defaults); $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.'); }
/** * Process the form submission. * * @return void */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { CRM_Financial_BAO_FinancialAccount::del($this->_id); CRM_Core_Session::setStatus(ts('Selected Financial Account has been deleted.')); } else { $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_Financial_BAO_FinancialAccount::add($params, $ids); CRM_Core_Session::setStatus(ts('The Financial Account \'%1\' has been saved.', array(1 => $contributionType->name))); } }
/** * Process the form submission. */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { CRM_Financial_BAO_FinancialAccount::del($this->_id); CRM_Core_Session::setStatus(ts('Selected Financial Account has been deleted.')); } else { // store the submitted values in an array $params = $this->exportValues(); if ($this->_action & CRM_Core_Action::UPDATE) { $params['id'] = $this->_id; } $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params); CRM_Core_Session::setStatus(ts('The Financial Account \'%1\' has been saved.', array(1 => $financialAccount->name)), ts('Saved'), 'success'); } }