3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Page for displaying list of financial types
21 class CRM_Financial_Page_FinancialAccount
extends CRM_Core_Page_Basic
{
23 public $useLivePageJS = TRUE;
25 * The action links that we need to display for the browse screen.
29 public static $_links = NULL;
37 public function getBAOName() {
38 return 'CRM_Financial_BAO_FinancialAccount';
45 * (reference) of action links
47 public function &links() {
48 if (!(self
::$_links)) {
50 CRM_Core_Action
::UPDATE
=> [
52 'url' => 'civicrm/admin/financial/financialAccount',
53 'qs' => 'action=update&id=%%id%%&reset=1',
54 'title' => ts('Edit Financial Type'),
56 CRM_Core_Action
::DISABLE
=> [
57 'name' => ts('Disable'),
58 'ref' => 'crm-enable-disable',
59 'title' => ts('Disable Financial Type'),
61 CRM_Core_Action
::ENABLE
=> [
62 'name' => ts('Enable'),
63 'ref' => 'crm-enable-disable',
64 'title' => ts('Enable Financial Type'),
66 CRM_Core_Action
::DELETE
=> [
67 'name' => ts('Delete'),
68 'url' => 'civicrm/admin/financial/financialAccount',
69 'qs' => 'action=delete&id=%%id%%',
70 'title' => ts('Delete Financial Type'),
78 * Browse all custom data groups.
80 public function browse() {
81 // get all custom groups sorted by weight
82 $contributionType = [];
83 $dao = new CRM_Financial_DAO_FinancialAccount();
84 $dao->orderBy('financial_account_type_id, name');
86 $financialAccountType = CRM_Core_PseudoConstant
::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
88 while ($dao->fetch()) {
89 $contributionType[$dao->id
] = [];
90 CRM_Core_DAO
::storeValues($dao, $contributionType[$dao->id
]);
91 $contributionType[$dao->id
]['financial_account_type_id'] = $financialAccountType[$dao->financial_account_type_id
];
92 // form all action links
93 $action = array_sum(array_keys($this->links()));
95 // update enable/disable links depending on if it is is_reserved or is_active
96 if ($dao->is_reserved
) {
100 if ($dao->is_active
) {
101 $action -= CRM_Core_Action
::ENABLE
;
104 $action -= CRM_Core_Action
::DISABLE
;
108 $contributionType[$dao->id
]['action'] = CRM_Core_Action
::formLink(self
::links(), $action,
112 'financialAccount.manage.action',
117 $this->assign('rows', $contributionType);
121 * Get name of edit form.
124 * Classname of edit form.
126 public function editForm() {
127 return 'CRM_Financial_Form_FinancialAccount';
131 * Get edit form name.
136 public function editName() {
137 return 'Financial Types';
148 public function userContext($mode = NULL) {
149 return 'civicrm/admin/financial/financialAccount';