* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
+use Civi\Api4\EntityFinancialAccount;
+
/**
* This class generates form components for Financial Type Account
*/
/**
* Process the form submission.
*/
- public function postProcess() {
+ public function postProcess(): void {
if ($this->_action & CRM_Core_Action::DELETE) {
try {
- CRM_Financial_BAO_FinancialTypeAccount::del($this->_id);
- CRM_Financial_BAO_EntityFinancialAccount::del($this->_id);
+ EntityFinancialAccount::delete()->addWhere('id', '=', $this->_id)->execute();
}
catch (CRM_Core_Exception $e) {
- CRM_Core_Session::setStatus($e->message);
- return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$this->_aid}"));
+ CRM_Core_Session::setStatus($e->getMessage());
+ CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$this->_aid}"));
}
CRM_Core_Session::setStatus(ts('Selected financial type account has been deleted.'));
}
else {
- $params = $ids = [];
+ $ids = [];
// store the submitted values in an array
$params = $this->exportValues();
$this->assertEquals($result, $financialType->id, 'Verify Account Type');
}
- /**
- * Check method del()
- */
- public function testDel() {
- list($financialAccount, $financialType, $financialAccountType) = $this->createFinancialAccount(
- 'Expenses',
- 'Expense Account is'
- );
-
- CRM_Financial_BAO_EntityFinancialAccount::del($financialAccountType->id);
- $params = ['id' => $financialAccountType->id];
- $result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults);
- $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.');
- }
-
/**
* Check method retrieve()
*/