Skip to content

Commit

Permalink
Merge pull request #19932 from eileenmcnaughton/ft
Browse files Browse the repository at this point in the history
dev/core#2486 Add entity financial trxn
  • Loading branch information
eileenmcnaughton authored Mar 29, 2021
2 parents 17a063b + becebb6 commit 027ef84
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 6 deletions.
31 changes: 31 additions & 0 deletions CRM/Financial/BAO/EntityFinancialTrxn.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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_EntityFinancialTrxn extends CRM_Financial_DAO_EntityFinancialTrxn {

/**
* Whitelist of possible values for the entity_table field
*
* @return array
*/
public static function entityTables(): array {
return [
'civicrm_contribution' => ts('Contribution'),
'civicrm_financial_item' => ts('Financial Item'),
];
}

}
15 changes: 9 additions & 6 deletions 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:c45a5259ff34bda9b9bad9ced505ff16)
*/

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_trxn.id',
'table_name' => 'civicrm_entity_financial_trxn',
'entity' => 'EntityFinancialTrxn',
'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
'localizable' => 0,
'html' => [
'type' => 'Number',
Expand All @@ -134,8 +134,11 @@ public static function &fields() {
'export' => TRUE,
'table_name' => 'civicrm_entity_financial_trxn',
'entity' => 'EntityFinancialTrxn',
'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
'localizable' => 0,
'pseudoconstant' => [
'callback' => 'CRM_Financial_BAO_EntityFinancialTrxn::entityTables',
],
'add' => '3.2',
],
'entity_id' => [
Expand All @@ -146,7 +149,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_trxn.entity_id',
'table_name' => 'civicrm_entity_financial_trxn',
'entity' => 'EntityFinancialTrxn',
'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
'localizable' => 0,
'add' => '3.2',
],
Expand All @@ -157,7 +160,7 @@ public static function &fields() {
'where' => 'civicrm_entity_financial_trxn.financial_trxn_id',
'table_name' => 'civicrm_entity_financial_trxn',
'entity' => 'EntityFinancialTrxn',
'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
'localizable' => 0,
'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn',
'html' => [
Expand All @@ -182,7 +185,7 @@ public static function &fields() {
'export' => TRUE,
'table_name' => 'civicrm_entity_financial_trxn',
'entity' => 'EntityFinancialTrxn',
'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
'localizable' => 0,
'add' => '3.2',
],
Expand Down
34 changes: 34 additions & 0 deletions Civi/Api4/EntityFinancialTrxn.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;

/**
* EntityFinancialTrxns. Joins financial transactions to contributions
* and financial items.
*
* @see https://docs.civicrm.org/dev/en/latest/financial/financialentities/
*
* @bridge entity_id financial_trxn_id
*
* @package Civi\Api4
*/
class EntityFinancialTrxn extends Generic\DAOEntity {
use Generic\Traits\EntityBridge;

}
3 changes: 3 additions & 0 deletions xml/schema/Financial/EntityFinancialTrxn.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<length>64</length>
<required>true</required>
<import>true</import>
<pseudoconstant>
<callback>CRM_Financial_BAO_EntityFinancialTrxn::entityTables</callback>
</pseudoconstant>
<add>3.2</add>
<comment>May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc</comment>
</field>
Expand Down

0 comments on commit 027ef84

Please sign in to comment.