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