dev/core#2486 Add entity financial trxn
authoreileen <emcnaughton@wikimedia.org>
Mon, 29 Mar 2021 00:11:23 +0000 (13:11 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 29 Mar 2021 00:11:23 +0000 (13:11 +1300)
CRM/Financial/BAO/EntityFinancialTrxn.php [new file with mode: 0644]
CRM/Financial/DAO/EntityFinancialTrxn.php
Civi/Api4/EntityFinancialTrxn.php [new file with mode: 0644]
xml/schema/Financial/EntityFinancialTrxn.xml

diff --git a/CRM/Financial/BAO/EntityFinancialTrxn.php b/CRM/Financial/BAO/EntityFinancialTrxn.php
new file mode 100644 (file)
index 0000000..3058b97
--- /dev/null
@@ -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'),
+    ];
+  }
+
+}
index 2e8cbc718451d6246869266f8679b03b6c5be553..fe3d2e098712c7e7cdae912ef00427546cce1917 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b5fb467815fb6b501dbd2f2cd789b1b9)
+ * (GenCodeChecksum:c45a5259ff34bda9b9bad9ced505ff16)
  */
 
 /**
@@ -113,7 +113,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
           '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',
@@ -134,8 +134,11 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
           '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' => [
@@ -146,7 +149,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
           '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',
         ],
@@ -157,7 +160,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
           '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' => [
@@ -182,7 +185,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
           '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',
         ],
diff --git a/Civi/Api4/EntityFinancialTrxn.php b/Civi/Api4/EntityFinancialTrxn.php
new file mode 100644 (file)
index 0000000..3ad135b
--- /dev/null
@@ -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;
+
+}
index dd40409bd9087b62b90cb84cdf866dced653c53c..b1fbbcc8ae1981eab572686802daee852ee61e45 100644 (file)
@@ -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>