Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 33 | * (GenCodeChecksum:8650c2685e9d125bed6f9b65ce208621) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Financial_DAO_EntityFinancialTrxn constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_entity_financial_trxn'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = false; | |
53 | /** | |
54 | * ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $entity_table; | |
65 | /** | |
66 | * | |
67 | * @var int unsigned | |
68 | */ | |
69 | public $entity_id; | |
70 | /** | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $financial_trxn_id; | |
75 | /** | |
76 | * allocated amount of transaction to this entity | |
77 | * | |
78 | * @var float | |
79 | */ | |
80 | public $amount; | |
81 | /** | |
f41f0342 | 82 | * Class constructor. |
e501603b TO |
83 | */ |
84 | function __construct() { | |
85 | $this->__table = 'civicrm_entity_financial_trxn'; | |
86 | parent::__construct(); | |
87 | } | |
88 | /** | |
f41f0342 | 89 | * Returns foreign keys and entity references. |
e501603b TO |
90 | * |
91 | * @return array | |
92 | * [CRM_Core_Reference_Interface] | |
93 | */ | |
94 | static function getReferenceColumns() { | |
346aaaba TO |
95 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
96 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_trxn_id', 'civicrm_financial_trxn', 'id'); | |
98 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); | |
99 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 100 | } |
346aaaba | 101 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
102 | } |
103 | /** | |
104 | * Returns all the column names of this table | |
105 | * | |
106 | * @return array | |
107 | */ | |
108 | static function &fields() { | |
346aaaba TO |
109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
110 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
111 | 'id' => array( |
112 | 'name' => 'id', | |
113 | 'type' => CRM_Utils_Type::T_INT, | |
114 | 'title' => ts('Entity Financial Transaction ID') , | |
115 | 'description' => 'ID', | |
116 | 'required' => true, | |
522a26c9 | 117 | 'table_name' => 'civicrm_entity_financial_trxn', |
118 | 'entity' => 'EntityFinancialTrxn', | |
119 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 120 | 'localizable' => 0, |
e501603b TO |
121 | ) , |
122 | 'entity_table' => array( | |
123 | 'name' => 'entity_table', | |
124 | 'type' => CRM_Utils_Type::T_STRING, | |
125 | 'title' => ts('Entity Table') , | |
126 | 'description' => 'May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc', | |
127 | 'required' => true, | |
128 | 'maxlength' => 64, | |
129 | 'size' => CRM_Utils_Type::BIG, | |
130 | 'import' => true, | |
131 | 'where' => 'civicrm_entity_financial_trxn.entity_table', | |
132 | 'headerPattern' => '', | |
133 | 'dataPattern' => '', | |
134 | 'export' => true, | |
522a26c9 | 135 | 'table_name' => 'civicrm_entity_financial_trxn', |
136 | 'entity' => 'EntityFinancialTrxn', | |
137 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 138 | 'localizable' => 0, |
e501603b TO |
139 | ) , |
140 | 'entity_id' => array( | |
141 | 'name' => 'entity_id', | |
142 | 'type' => CRM_Utils_Type::T_INT, | |
143 | 'title' => ts('Entity ID') , | |
144 | 'required' => true, | |
522a26c9 | 145 | 'table_name' => 'civicrm_entity_financial_trxn', |
146 | 'entity' => 'EntityFinancialTrxn', | |
147 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 148 | 'localizable' => 0, |
e501603b TO |
149 | ) , |
150 | 'financial_trxn_id' => array( | |
151 | 'name' => 'financial_trxn_id', | |
152 | 'type' => CRM_Utils_Type::T_INT, | |
153 | 'title' => ts('Financial Transaction Id') , | |
522a26c9 | 154 | 'table_name' => 'civicrm_entity_financial_trxn', |
155 | 'entity' => 'EntityFinancialTrxn', | |
156 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 157 | 'localizable' => 0, |
e501603b TO |
158 | 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn', |
159 | ) , | |
160 | 'amount' => array( | |
161 | 'name' => 'amount', | |
162 | 'type' => CRM_Utils_Type::T_MONEY, | |
163 | 'title' => ts('Amount') , | |
164 | 'description' => 'allocated amount of transaction to this entity', | |
165 | 'required' => true, | |
166 | 'precision' => array( | |
167 | 20, | |
168 | 2 | |
169 | ) , | |
170 | 'import' => true, | |
171 | 'where' => 'civicrm_entity_financial_trxn.amount', | |
172 | 'headerPattern' => '/amount/i', | |
173 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
174 | 'export' => true, | |
522a26c9 | 175 | 'table_name' => 'civicrm_entity_financial_trxn', |
176 | 'entity' => 'EntityFinancialTrxn', | |
177 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 178 | 'localizable' => 0, |
e501603b TO |
179 | ) , |
180 | ); | |
346aaaba | 181 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 182 | } |
346aaaba | 183 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
184 | } |
185 | /** | |
bd8e0b14 | 186 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
187 | * |
188 | * @return array | |
bd8e0b14 | 189 | * Array(string $name => string $uniqueName). |
e501603b TO |
190 | */ |
191 | static function &fieldKeys() { | |
bd8e0b14 TO |
192 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
193 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 194 | } |
bd8e0b14 | 195 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
196 | } |
197 | /** | |
198 | * Returns the names of this table | |
199 | * | |
200 | * @return string | |
201 | */ | |
202 | static function getTableName() { | |
203 | return self::$_tableName; | |
204 | } | |
205 | /** | |
206 | * Returns if this table needs to be logged | |
207 | * | |
208 | * @return boolean | |
209 | */ | |
210 | function getLog() { | |
211 | return self::$_log; | |
212 | } | |
213 | /** | |
214 | * Returns the list of fields that can be imported | |
215 | * | |
216 | * @param bool $prefix | |
217 | * | |
218 | * @return array | |
219 | */ | |
220 | static function &import($prefix = false) { | |
60808919 TO |
221 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, array()); |
222 | return $r; | |
e501603b TO |
223 | } |
224 | /** | |
225 | * Returns the list of fields that can be exported | |
226 | * | |
227 | * @param bool $prefix | |
228 | * | |
229 | * @return array | |
230 | */ | |
231 | static function &export($prefix = false) { | |
60808919 TO |
232 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, array()); |
233 | return $r; | |
e501603b | 234 | } |
e7a6b91a AS |
235 | /** |
236 | * Returns the list of indices | |
237 | */ | |
238 | public static function indices($localize = TRUE) { | |
239 | $indices = array( | |
240 | 'UI_entity_financial_trxn_entity_table' => array( | |
241 | 'name' => 'UI_entity_financial_trxn_entity_table', | |
242 | 'field' => array( | |
243 | 0 => 'entity_table', | |
244 | ) , | |
245 | 'localizable' => false, | |
246 | 'sig' => 'civicrm_entity_financial_trxn::0::entity_table', | |
247 | ) , | |
248 | 'UI_entity_financial_trxn_entity_id' => array( | |
249 | 'name' => 'UI_entity_financial_trxn_entity_id', | |
250 | 'field' => array( | |
251 | 0 => 'entity_id', | |
252 | ) , | |
253 | 'localizable' => false, | |
254 | 'sig' => 'civicrm_entity_financial_trxn::0::entity_id', | |
255 | ) , | |
256 | ); | |
257 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
258 | } | |
e501603b | 259 | } |