Skip to content

Commit

Permalink
Add entity financial account
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Mar 28, 2021
1 parent 21f7fb7 commit 23ab13b
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 8 deletions.
32 changes: 32 additions & 0 deletions CRM/Financial/BAO/EntityFinancialAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/

/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
class CRM_Financial_BAO_EntityFinancialAccount extends CRM_Financial_DAO_EntityFinancialAccount {

/**
* Whitelist of possible values for the entity_table field
*
* @return array
*/
public static function entityTables(): array {
return [
'civicrm_financial_type' => ts('Financial Type'),
'civicrm_option_value' => ts('Payment Instrument'),
'civicrm_payment_processor' => ts('Payment Processor'),
];
}

}
15 changes: 9 additions & 6 deletions CRM/Financial/DAO/EntityFinancialAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:caf02136c148fe50dbc39d8d29605f72)
* (GenCodeChecksum:ac2a0a2e8eae1471b71da25e95b52d55)
*/

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_account.id',
'table_name' => 'civicrm_entity_financial_account',
'entity' => 'EntityFinancialAccount',
'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
'localizable' => 0,
'html' => [
'type' => 'Number',
Expand All @@ -138,8 +138,11 @@ public static function &fields() {
'export' => TRUE,
'table_name' => 'civicrm_entity_financial_account',
'entity' => 'EntityFinancialAccount',
'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
'localizable' => 0,
'pseudoconstant' => [
'callback' => 'CRM_Financial_BAO_EntityFinancialAccount::entityTables',
],
'add' => '4.3',
],
'entity_id' => [
Expand All @@ -151,7 +154,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_account.entity_id',
'table_name' => 'civicrm_entity_financial_account',
'entity' => 'EntityFinancialAccount',
'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
'localizable' => 0,
'add' => '4.3',
],
Expand All @@ -164,7 +167,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_account.account_relationship',
'table_name' => 'civicrm_entity_financial_account',
'entity' => 'EntityFinancialAccount',
'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
'localizable' => 0,
'html' => [
'type' => 'Select',
Expand All @@ -184,7 +187,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_account.financial_account_id',
'table_name' => 'civicrm_entity_financial_account',
'entity' => 'EntityFinancialAccount',
'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
'localizable' => 0,
'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
'html' => [
Expand Down
2 changes: 1 addition & 1 deletion CRM/Financial/DAO/EntityFinancialTrxn.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:b5fb467815fb6b501dbd2f2cd789b1b9)
* (GenCodeChecksum:1bd83e1707709743a254644741326fce)
*/

/**
Expand Down
34 changes: 34 additions & 0 deletions Civi/Api4/EntityFinancialAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/

/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/

namespace Civi\Api4;

/**
* EntityFinancialAccount. Joins financial accounts to financial types.
*
* @see https://docs.civicrm.org/dev/en/latest/financial/financialentities/#financial-accounts
*
* @bridge entity_id financial_account_id
* @ui_join_filters account_relationship
*
* @package Civi\Api4
*/
class EntityFinancialAccount extends Generic\DAOEntity {
use Generic\Traits\EntityBridge;

}
2 changes: 1 addition & 1 deletion tests/phpunit/api/v3/PaymentProcessorTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testPaymentProcessorTypeCreateWithoutName($version) {
*
* @param int $version
*/
public function testPaymentProcessorTypeCreate($version) {
public function testPaymentProcessorTypeCreate($version): void {
$this->_apiversion = $version;
$params = [
'sequential' => 1,
Expand Down
3 changes: 3 additions & 0 deletions xml/schema/Financial/EntityFinancialAccount.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<import>true</import>
<add>4.3</add>
<comment>Links to an entity_table like civicrm_financial_type</comment>
<pseudoconstant>
<callback>CRM_Financial_BAO_EntityFinancialAccount::entityTables</callback>
</pseudoconstant>
</field>
<field>
<name>entity_id</name>
Expand Down

0 comments on commit 23ab13b

Please sign in to comment.