Cleanup variables in event/contribution register forms
[civicrm-core.git] / CRM / Financial / DAO / EntityFinancialTrxn.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
929a1c14 9 * (GenCodeChecksum:12eb23afdf6c1208bdc01aa7db52770a)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the EntityFinancialTrxn entity.
f41f0342 14 */
e501603b 15class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.2';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_entity_financial_trxn';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * ID
35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc
42 *
43 * @var string
44 */
45 public $entity_table;
c3fc2621 46
e501603b 47 /**
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $entity_id;
c3fc2621 51
e501603b 52 /**
e6ca0a57 53 * @var int
e501603b
TO
54 */
55 public $financial_trxn_id;
c3fc2621 56
e501603b
TO
57 /**
58 * allocated amount of transaction to this entity
59 *
60 * @var float
61 */
62 public $amount;
c3fc2621 63
e501603b 64 /**
f41f0342 65 * Class constructor.
e501603b 66 */
c3fc2621 67 public function __construct() {
e501603b
TO
68 $this->__table = 'civicrm_entity_financial_trxn';
69 parent::__construct();
70 }
c3fc2621 71
449c4e6b
CW
72 /**
73 * Returns localized title of this entity.
74 */
75 public static function getEntityTitle() {
76 return ts('Entity Financial Trxns');
77 }
78
e501603b 79 /**
f41f0342 80 * Returns foreign keys and entity references.
e501603b
TO
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
c3fc2621 85 public static function getReferenceColumns() {
346aaaba 86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_trxn_id', 'civicrm_financial_trxn', 'id');
89 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 90 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 91 }
346aaaba 92 return Civi::$statics[__CLASS__]['links'];
e501603b 93 }
c3fc2621 94
e501603b
TO
95 /**
96 * Returns all the column names of this table
97 *
98 * @return array
99 */
c3fc2621 100 public static function &fields() {
346aaaba 101 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
102 Civi::$statics[__CLASS__]['fields'] = [
103 'id' => [
e501603b
TO
104 'name' => 'id',
105 'type' => CRM_Utils_Type::T_INT,
c3fc2621 106 'title' => ts('Entity Financial Transaction ID'),
215b423e 107 'description' => ts('ID'),
c3fc2621 108 'required' => TRUE,
a36434b9 109 'where' => 'civicrm_entity_financial_trxn.id',
522a26c9 110 'table_name' => 'civicrm_entity_financial_trxn',
111 'entity' => 'EntityFinancialTrxn',
112 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 113 'localizable' => 0,
a9d0587b 114 'add' => '3.2',
c3fc2621
CW
115 ],
116 'entity_table' => [
e501603b
TO
117 'name' => 'entity_table',
118 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 119 'title' => ts('Entity Table'),
215b423e 120 'description' => ts('May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc'),
c3fc2621 121 'required' => TRUE,
e501603b
TO
122 'maxlength' => 64,
123 'size' => CRM_Utils_Type::BIG,
c3fc2621 124 'import' => TRUE,
e501603b 125 'where' => 'civicrm_entity_financial_trxn.entity_table',
c3fc2621 126 'export' => TRUE,
522a26c9 127 'table_name' => 'civicrm_entity_financial_trxn',
128 'entity' => 'EntityFinancialTrxn',
129 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 130 'localizable' => 0,
a9d0587b 131 'add' => '3.2',
c3fc2621
CW
132 ],
133 'entity_id' => [
e501603b
TO
134 'name' => 'entity_id',
135 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
136 'title' => ts('Entity ID'),
137 'required' => TRUE,
a36434b9 138 'where' => 'civicrm_entity_financial_trxn.entity_id',
522a26c9 139 'table_name' => 'civicrm_entity_financial_trxn',
140 'entity' => 'EntityFinancialTrxn',
141 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 142 'localizable' => 0,
a9d0587b 143 'add' => '3.2',
c3fc2621
CW
144 ],
145 'financial_trxn_id' => [
e501603b
TO
146 'name' => 'financial_trxn_id',
147 'type' => CRM_Utils_Type::T_INT,
c3fc2621 148 'title' => ts('Financial Transaction Id'),
a36434b9 149 'where' => 'civicrm_entity_financial_trxn.financial_trxn_id',
522a26c9 150 'table_name' => 'civicrm_entity_financial_trxn',
151 'entity' => 'EntityFinancialTrxn',
152 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 153 'localizable' => 0,
e501603b 154 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn',
a9d0587b 155 'add' => '3.2',
c3fc2621
CW
156 ],
157 'amount' => [
e501603b
TO
158 'name' => 'amount',
159 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 160 'title' => ts('Amount'),
215b423e 161 'description' => ts('allocated amount of transaction to this entity'),
c3fc2621
CW
162 'required' => TRUE,
163 'precision' => [
e501603b 164 20,
fb607354 165 2,
c3fc2621
CW
166 ],
167 'import' => TRUE,
e501603b
TO
168 'where' => 'civicrm_entity_financial_trxn.amount',
169 'headerPattern' => '/amount/i',
170 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 171 'export' => TRUE,
522a26c9 172 'table_name' => 'civicrm_entity_financial_trxn',
173 'entity' => 'EntityFinancialTrxn',
174 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 175 'localizable' => 0,
a9d0587b 176 'add' => '3.2',
c3fc2621
CW
177 ],
178 ];
346aaaba 179 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 180 }
346aaaba 181 return Civi::$statics[__CLASS__]['fields'];
e501603b 182 }
c3fc2621 183
e501603b 184 /**
bd8e0b14 185 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
186 *
187 * @return array
bd8e0b14 188 * Array(string $name => string $uniqueName).
e501603b 189 */
c3fc2621 190 public static function &fieldKeys() {
bd8e0b14
TO
191 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
192 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 193 }
bd8e0b14 194 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 195 }
c3fc2621 196
e501603b
TO
197 /**
198 * Returns the names of this table
199 *
200 * @return string
201 */
c3fc2621 202 public static function getTableName() {
e501603b
TO
203 return self::$_tableName;
204 }
c3fc2621 205
e501603b
TO
206 /**
207 * Returns if this table needs to be logged
208 *
c3fc2621 209 * @return bool
e501603b 210 */
c3fc2621 211 public function getLog() {
e501603b
TO
212 return self::$_log;
213 }
c3fc2621 214
e501603b
TO
215 /**
216 * Returns the list of fields that can be imported
217 *
218 * @param bool $prefix
219 *
220 * @return array
221 */
c3fc2621
CW
222 public static function &import($prefix = FALSE) {
223 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, []);
60808919 224 return $r;
e501603b 225 }
c3fc2621 226
e501603b
TO
227 /**
228 * Returns the list of fields that can be exported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
c3fc2621
CW
234 public static function &export($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, []);
60808919 236 return $r;
e501603b 237 }
c3fc2621 238
e7a6b91a
AS
239 /**
240 * Returns the list of indices
c3fc2621
CW
241 *
242 * @param bool $localize
243 *
244 * @return array
e7a6b91a
AS
245 */
246 public static function indices($localize = TRUE) {
c3fc2621
CW
247 $indices = [
248 'UI_entity_financial_trxn_entity_table' => [
e7a6b91a 249 'name' => 'UI_entity_financial_trxn_entity_table',
c3fc2621 250 'field' => [
e7a6b91a 251 0 => 'entity_table',
c3fc2621
CW
252 ],
253 'localizable' => FALSE,
e7a6b91a 254 'sig' => 'civicrm_entity_financial_trxn::0::entity_table',
c3fc2621
CW
255 ],
256 'UI_entity_financial_trxn_entity_id' => [
e7a6b91a 257 'name' => 'UI_entity_financial_trxn_entity_id',
c3fc2621 258 'field' => [
e7a6b91a 259 0 => 'entity_id',
c3fc2621
CW
260 ],
261 'localizable' => FALSE,
e7a6b91a 262 'sig' => 'civicrm_entity_financial_trxn::0::entity_id',
c3fc2621
CW
263 ],
264 ];
e7a6b91a
AS
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
266 }
c3fc2621 267
e501603b 268}