From e0c723c3a9b958c0f715e9314b408582d37ef87e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 13 Oct 2022 13:46:04 +0100 Subject: [PATCH] AdminUI - Add Assigned Financial Accounts table --- CRM/Financial/DAO/EntityFinancialAccount.php | 10 +- Civi/Api4/EntityFinancialAccount.php | 2 +- ...afsearchAssignedFinancialAccounts.aff.html | 3 + ...afsearchAssignedFinancialAccounts.aff.json | 18 ++ ...nister_Assigned_Financial_Accounts.mgd.php | 172 ++++++++++++++++++ ...dSearch_Administer_Financial_Types.mgd.php | 4 +- .../Financial/EntityFinancialAccount.xml | 8 + 7 files changed, 213 insertions(+), 4 deletions(-) create mode 100644 ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.html create mode 100644 ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.json create mode 100644 ext/civicrm_admin_ui/managed/SavedSearch_Administer_Assigned_Financial_Accounts.mgd.php diff --git a/CRM/Financial/DAO/EntityFinancialAccount.php b/CRM/Financial/DAO/EntityFinancialAccount.php index 862307db19..360c446ada 100644 --- a/CRM/Financial/DAO/EntityFinancialAccount.php +++ b/CRM/Financial/DAO/EntityFinancialAccount.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:07db4c1bfeb7147c09b6d095fc19bae2) + * (GenCodeChecksum:7a29bf464501ce9292e409ae68d80782) */ /** @@ -150,6 +150,10 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO { 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', 'localizable' => 0, + 'html' => [ + 'type' => 'Select', + 'label' => ts("Entity Type"), + ], 'pseudoconstant' => [ 'callback' => 'CRM_Financial_BAO_EntityFinancialAccount::entityTables', ], @@ -166,6 +170,10 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO { 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', 'localizable' => 0, + 'html' => [ + 'type' => 'EntityRef', + 'label' => ts("Entity"), + ], 'add' => '4.3', ], 'account_relationship' => [ diff --git a/Civi/Api4/EntityFinancialAccount.php b/Civi/Api4/EntityFinancialAccount.php index 4be18592aa..7d1f718569 100644 --- a/Civi/Api4/EntityFinancialAccount.php +++ b/Civi/Api4/EntityFinancialAccount.php @@ -17,7 +17,7 @@ namespace Civi\Api4; * * @ui_join_filters account_relationship * - * @searchable bridge + * @searchable secondary * @since 5.37 * @package Civi\Api4 */ diff --git a/ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.html b/ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.html new file mode 100644 index 0000000000..42dc7e1252 --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.json b/ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.json new file mode 100644 index 0000000000..30fbd772c6 --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchAssignedFinancialAccounts.aff.json @@ -0,0 +1,18 @@ +{ + "type": "search", + "title": "Assigned Financial Accounts", + "icon": "fa-list-alt", + "server_route": "civicrm/admin/financial/financialType/accounts/list", + "permission": "administer CiviCRM", + "requires": [], + "description": "", + "is_dashlet": false, + "is_public": false, + "is_token": false, + "entity_type": null, + "join_entity": null, + "contact_summary": null, + "redirect": null, + "create_submission": null, + "navigation": null +} diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Assigned_Financial_Accounts.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Assigned_Financial_Accounts.mgd.php new file mode 100644 index 0000000000..624f67d23e --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Assigned_Financial_Accounts.mgd.php @@ -0,0 +1,172 @@ + 'SavedSearch_Administer_Assigned_Financial_Accounts', + 'entity' => 'SavedSearch', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Administer_Assigned_Financial_Accounts', + 'label' => E::ts('Administer Assigned Financial Accounts'), + 'form_values' => NULL, + 'mapping_id' => NULL, + 'search_custom_id' => NULL, + 'api_entity' => 'EntityFinancialAccount', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'account_relationship:label', + 'financial_account_id:label', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.accounting_code', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.financial_account_type_id:label', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.account_type_code', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.contact_id.display_name', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.is_active', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [], + 'join' => [ + [ + 'FinancialAccount AS EntityFinancialAccount_FinancialAccount_financial_account_id_01', + 'LEFT', + [ + 'financial_account_id', + '=', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.id', + ], + ], + ], + 'having' => [], + ], + 'expires_date' => NULL, + 'description' => NULL, + ], + ], + ], + [ + 'name' => 'SavedSearch_Administer_Assigned_Financial_Accounts_SearchDisplay_Entity_Financial_Accounts_Table', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Entity_Financial_Accounts_Table_1', + 'label' => E::ts('Entity Financial Accounts Table'), + 'saved_search_id.name' => 'Administer_Assigned_Financial_Accounts', + 'type' => 'table', + 'settings' => [ + 'actions' => FALSE, + 'limit' => 50, + 'classes' => [ + 'table', + 'table-striped', + ], + 'pager' => [ + 'show_count' => TRUE, + ], + 'placeholder' => 5, + 'sort' => [], + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'account_relationship:label', + 'dataType' => 'Integer', + 'label' => E::ts('Relationship'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'financial_account_id:label', + 'dataType' => 'Integer', + 'label' => E::ts('Financial Account'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.accounting_code', + 'dataType' => 'String', + 'label' => E::ts('Accounting Code'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.financial_account_type_id:label', + 'dataType' => 'Integer', + 'label' => E::ts('Account Type (Code)'), + 'sortable' => TRUE, + 'rewrite' => '[EntityFinancialAccount_FinancialAccount_financial_account_id_01.financial_account_type_id:label] ([EntityFinancialAccount_FinancialAccount_financial_account_id_01.account_type_code])', + ], + [ + 'type' => 'field', + 'key' => 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.contact_id.display_name', + 'dataType' => 'String', + 'label' => E::ts('Owner'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.is_active', + 'dataType' => 'Boolean', + 'label' => E::ts('Enabled'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'size' => 'btn-xs', + 'links' => [ + [ + 'path' => 'civicrm/admin/financial/financialType/accounts?action=update&id=[id]&aid=[entity_id]&reset=1', + 'icon' => 'fa-pencil', + 'text' => E::ts('Edit'), + 'style' => 'default', + 'condition' => [], + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'path' => 'civicrm/admin/financial/financialType/accounts?action=delete&id=[id]&aid=[entity_id]&reset=1', + 'icon' => 'fa-trash', + 'text' => E::ts('Delete'), + 'style' => 'danger', + 'condition' => [ + 'account_relationship:label', + '!=', + 'Accounts Receivable Account is', + ], + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => 'crm-popup', + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + ], + 'cssRules' => [ + [ + 'disabled', + 'EntityFinancialAccount_FinancialAccount_financial_account_id_01.is_active', + '=', + FALSE, + ], + ], + 'addButton' => [ + 'path' => 'civicrm/admin/financial/financialType/accounts?action=add&reset=1&aid=[entity_id]', + 'text' => E::ts('Add Assigned Account'), + 'icon' => 'fa-plus', + ], + ], + 'acl_bypass' => FALSE, + ], + ], + ], +]; diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Financial_Types.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Financial_Types.mgd.php index ba12f58fca..e8c32d7bf8 100644 --- a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Financial_Types.mgd.php +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Financial_Types.mgd.php @@ -134,8 +134,8 @@ return [ 'size' => 'btn-xs', 'links' => [ [ - 'path' => 'civicrm/admin/financial/financialType/accounts?reset=1&action=browse&aid=[id]', - 'icon' => '', + 'path' => 'civicrm/admin/financial/financialType/accounts/list#/?entity_id=[id]', + 'icon' => 'fa-external-link', 'text' => E::ts('Accounts'), 'style' => 'default', 'condition' => [], diff --git a/xml/schema/Financial/EntityFinancialAccount.xml b/xml/schema/Financial/EntityFinancialAccount.xml index 8c70d4c706..580fd8cd45 100644 --- a/xml/schema/Financial/EntityFinancialAccount.xml +++ b/xml/schema/Financial/EntityFinancialAccount.xml @@ -31,6 +31,10 @@ true true 4.3 + + + Select + Links to an entity_table like civicrm_financial_type CRM_Financial_BAO_EntityFinancialAccount::entityTables @@ -42,6 +46,10 @@ int unsigned true 4.3 + + + EntityRef + Links to an id in the entity_table, such as vid in civicrm_financial_type -- 2.25.1