Skip to content
Snippets Groups Projects
Commit 06a2050e authored by Seamus Lee's avatar Seamus Lee
Browse files

[REF] Fix return value on deleting financial type

Extend unit test to cover deleting fin type
parent 0b28857c
Branches
Tags
No related merge requests found
......@@ -153,7 +153,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
$entityFinancialType->entity_id = $financialTypeId;
$entityFinancialType->entity_table = 'civicrm_financial_type';
$entityFinancialType->delete();
return FALSE;
return TRUE;
}
/**
......
......@@ -118,7 +118,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
$errors = CRM_Financial_BAO_FinancialType::del($this->_id);
if (!empty($errors)) {
if (is_array($errors) && !empty($errors)) {
CRM_Core_Error::statusBounce($errors['error_message'], CRM_Utils_System::url('civicrm/admin/financial/financialType', "reset=1&action=browse"), ts('Cannot Delete'));
}
CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'), ts('Record Deleted'), 'success');
......
......@@ -86,6 +86,7 @@ class api_v3_FinancialTypeTest extends CiviUnitTestCase {
$this->callAPISuccessGetSingle('FinancialType', [
'id' => $financialType['id'],
], $expectedResult);
$this->callAPISuccess('FinancialType', 'delete', ['id' => $financialType['id']]);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment