CRM-15198 - Fix error messages when unable to delete financial type
authorColeman Watts <coleman@civicrm.org>
Thu, 28 Aug 2014 16:30:04 +0000 (17:30 +0100)
committerColeman Watts <coleman@civicrm.org>
Thu, 28 Aug 2014 16:30:04 +0000 (17:30 +0100)
CRM/Financial/Form/FinancialType.php

index 7d75bfefe6e4ba54a2c6867bf2b37b01534a70e2..5fc26ef16a8257b338fc893c2f163733c092179a 100644 (file)
@@ -87,9 +87,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
     if ($this->_action & CRM_Core_Action::DELETE) {
       $errors = CRM_Financial_BAO_FinancialType::del($this->_id);
       if (!empty($errors)) {
-        $message = ts('This item cannot be deleted.') . $errors['error_message'];
-        CRM_Core_Session::setStatus($message);
-        return CRM_Utils_System::redirect(CRM_Utils_System::url( 'civicrm/admin/financial/financialType', "reset=1&action=browse"));
+        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.'));
     }