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/FinancialAccount.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:14d3715c48b20555e6bce4ff679cd251) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Financial_DAO_FinancialAccount constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Financial_DAO_FinancialAccount 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_financial_account'; | |
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 = true; | |
53 | /** | |
54 | * ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Financial Account Name. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
65 | /** | |
66 | * FK to Contact ID that is responsible for the funds in this account | |
67 | * | |
68 | * @var int unsigned | |
69 | */ | |
70 | public $contact_id; | |
71 | /** | |
72 | * pseudo FK into civicrm_option_value. | |
73 | * | |
74 | * @var int unsigned | |
75 | */ | |
76 | public $financial_account_type_id; | |
77 | /** | |
78 | * Optional value for mapping monies owed and received to accounting system codes. | |
79 | * | |
80 | * @var string | |
81 | */ | |
82 | public $accounting_code; | |
83 | /** | |
84 | * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example). | |
85 | * | |
86 | * @var string | |
87 | */ | |
88 | public $account_type_code; | |
89 | /** | |
90 | * Financial Type Description. | |
91 | * | |
92 | * @var string | |
93 | */ | |
94 | public $description; | |
95 | /** | |
96 | * Parent ID in account hierarchy | |
97 | * | |
98 | * @var int unsigned | |
99 | */ | |
100 | public $parent_id; | |
101 | /** | |
102 | * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts? | |
103 | * | |
104 | * @var boolean | |
105 | */ | |
106 | public $is_header_account; | |
107 | /** | |
108 | * Is this account tax-deductible? | |
109 | * | |
110 | * @var boolean | |
111 | */ | |
112 | public $is_deductible; | |
113 | /** | |
114 | * Is this account for taxes? | |
115 | * | |
116 | * @var boolean | |
117 | */ | |
118 | public $is_tax; | |
119 | /** | |
120 | * The percentage of the total_amount that is due for this tax. | |
121 | * | |
122 | * @var float | |
123 | */ | |
124 | public $tax_rate; | |
125 | /** | |
126 | * Is this a predefined system object? | |
127 | * | |
128 | * @var boolean | |
129 | */ | |
130 | public $is_reserved; | |
131 | /** | |
132 | * Is this property active? | |
133 | * | |
134 | * @var boolean | |
135 | */ | |
136 | public $is_active; | |
137 | /** | |
138 | * Is this account the default one (or default tax one) for its financial_account_type? | |
139 | * | |
140 | * @var boolean | |
141 | */ | |
142 | public $is_default; | |
e501603b | 143 | /** |
f41f0342 | 144 | * Class constructor. |
e501603b TO |
145 | */ |
146 | function __construct() { | |
147 | $this->__table = 'civicrm_financial_account'; | |
148 | parent::__construct(); | |
149 | } | |
150 | /** | |
f41f0342 | 151 | * Returns foreign keys and entity references. |
e501603b TO |
152 | * |
153 | * @return array | |
154 | * [CRM_Core_Reference_Interface] | |
155 | */ | |
156 | static function getReferenceColumns() { | |
346aaaba TO |
157 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
158 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
159 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
160 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_financial_account', 'id'); | |
161 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 162 | } |
346aaaba | 163 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
164 | } |
165 | /** | |
166 | * Returns all the column names of this table | |
167 | * | |
168 | * @return array | |
169 | */ | |
170 | static function &fields() { | |
346aaaba TO |
171 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
172 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
173 | 'id' => array( |
174 | 'name' => 'id', | |
175 | 'type' => CRM_Utils_Type::T_INT, | |
176 | 'title' => ts('Financial Account ID') , | |
177 | 'description' => 'ID', | |
178 | 'required' => true, | |
522a26c9 | 179 | 'table_name' => 'civicrm_financial_account', |
180 | 'entity' => 'FinancialAccount', | |
181 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
182 | ) , |
183 | 'name' => array( | |
184 | 'name' => 'name', | |
185 | 'type' => CRM_Utils_Type::T_STRING, | |
186 | 'title' => ts('Financial Account Name') , | |
187 | 'description' => 'Financial Account Name.', | |
188 | 'required' => true, | |
189 | 'maxlength' => 255, | |
190 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 191 | 'table_name' => 'civicrm_financial_account', |
192 | 'entity' => 'FinancialAccount', | |
193 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
194 | ) , |
195 | 'financial_account_contact_id' => array( | |
196 | 'name' => 'contact_id', | |
197 | 'type' => CRM_Utils_Type::T_INT, | |
198 | 'title' => ts('Contact ID') , | |
199 | 'description' => 'FK to Contact ID that is responsible for the funds in this account', | |
522a26c9 | 200 | 'table_name' => 'civicrm_financial_account', |
201 | 'entity' => 'FinancialAccount', | |
202 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
203 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
204 | ) , | |
205 | 'financial_account_type_id' => array( | |
206 | 'name' => 'financial_account_type_id', | |
207 | 'type' => CRM_Utils_Type::T_INT, | |
208 | 'title' => ts('Financial Account Type') , | |
209 | 'description' => 'pseudo FK into civicrm_option_value.', | |
210 | 'required' => true, | |
211 | 'default' => '3', | |
522a26c9 | 212 | 'table_name' => 'civicrm_financial_account', |
213 | 'entity' => 'FinancialAccount', | |
214 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
215 | 'html' => array( |
216 | 'type' => 'Select', | |
217 | ) , | |
218 | 'pseudoconstant' => array( | |
219 | 'optionGroupName' => 'financial_account_type', | |
220 | 'optionEditPath' => 'civicrm/admin/options/financial_account_type', | |
221 | ) | |
222 | ) , | |
223 | 'accounting_code' => array( | |
224 | 'name' => 'accounting_code', | |
225 | 'type' => CRM_Utils_Type::T_STRING, | |
226 | 'title' => ts('Accounting Code') , | |
227 | 'description' => 'Optional value for mapping monies owed and received to accounting system codes.', | |
228 | 'maxlength' => 64, | |
229 | 'size' => CRM_Utils_Type::BIG, | |
230 | 'export' => true, | |
231 | 'where' => 'civicrm_financial_account.accounting_code', | |
232 | 'headerPattern' => '', | |
233 | 'dataPattern' => '', | |
522a26c9 | 234 | 'table_name' => 'civicrm_financial_account', |
235 | 'entity' => 'FinancialAccount', | |
236 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
237 | ) , |
238 | 'account_type_code' => array( | |
239 | 'name' => 'account_type_code', | |
240 | 'type' => CRM_Utils_Type::T_STRING, | |
241 | 'title' => ts('Account Type Code') , | |
242 | 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).', | |
243 | 'maxlength' => 64, | |
244 | 'size' => CRM_Utils_Type::BIG, | |
245 | 'export' => true, | |
246 | 'where' => 'civicrm_financial_account.account_type_code', | |
247 | 'headerPattern' => '', | |
248 | 'dataPattern' => '', | |
522a26c9 | 249 | 'table_name' => 'civicrm_financial_account', |
250 | 'entity' => 'FinancialAccount', | |
251 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
252 | ) , |
253 | 'description' => array( | |
254 | 'name' => 'description', | |
255 | 'type' => CRM_Utils_Type::T_STRING, | |
256 | 'title' => ts('Financial Account Description') , | |
257 | 'description' => 'Financial Type Description.', | |
258 | 'maxlength' => 255, | |
259 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 260 | 'table_name' => 'civicrm_financial_account', |
261 | 'entity' => 'FinancialAccount', | |
262 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
263 | ) , |
264 | 'parent_id' => array( | |
265 | 'name' => 'parent_id', | |
266 | 'type' => CRM_Utils_Type::T_INT, | |
267 | 'title' => ts('Financial Account Parent') , | |
268 | 'description' => 'Parent ID in account hierarchy', | |
522a26c9 | 269 | 'table_name' => 'civicrm_financial_account', |
270 | 'entity' => 'FinancialAccount', | |
271 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
272 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', |
273 | ) , | |
274 | 'is_header_account' => array( | |
275 | 'name' => 'is_header_account', | |
276 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
277 | 'title' => ts('Header Financial Account?') , | |
278 | 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?', | |
522a26c9 | 279 | 'table_name' => 'civicrm_financial_account', |
280 | 'entity' => 'FinancialAccount', | |
281 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
282 | ) , |
283 | 'is_deductible' => array( | |
284 | 'name' => 'is_deductible', | |
285 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
286 | 'title' => ts('Deductible Financial Account?') , | |
287 | 'description' => 'Is this account tax-deductible?', | |
288 | 'default' => '1', | |
522a26c9 | 289 | 'table_name' => 'civicrm_financial_account', |
290 | 'entity' => 'FinancialAccount', | |
291 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
292 | ) , |
293 | 'is_tax' => array( | |
294 | 'name' => 'is_tax', | |
295 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
296 | 'title' => ts('Tax Financial Account?') , | |
297 | 'description' => 'Is this account for taxes?', | |
522a26c9 | 298 | 'table_name' => 'civicrm_financial_account', |
299 | 'entity' => 'FinancialAccount', | |
300 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
301 | ) , |
302 | 'tax_rate' => array( | |
303 | 'name' => 'tax_rate', | |
304 | 'type' => CRM_Utils_Type::T_MONEY, | |
305 | 'title' => ts('Financial Account Tax Rate') , | |
306 | 'description' => 'The percentage of the total_amount that is due for this tax.', | |
307 | 'precision' => array( | |
308 | 10, | |
309 | 8 | |
310 | ) , | |
522a26c9 | 311 | 'table_name' => 'civicrm_financial_account', |
312 | 'entity' => 'FinancialAccount', | |
313 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
314 | ) , |
315 | 'is_reserved' => array( | |
316 | 'name' => 'is_reserved', | |
317 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
318 | 'title' => ts('Reserved Financial Account?') , | |
319 | 'description' => 'Is this a predefined system object?', | |
522a26c9 | 320 | 'table_name' => 'civicrm_financial_account', |
321 | 'entity' => 'FinancialAccount', | |
322 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
323 | ) , |
324 | 'is_active' => array( | |
325 | 'name' => 'is_active', | |
326 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
327 | 'title' => ts('Financial Account is Active') , | |
328 | 'description' => 'Is this property active?', | |
522a26c9 | 329 | 'table_name' => 'civicrm_financial_account', |
330 | 'entity' => 'FinancialAccount', | |
331 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b TO |
332 | ) , |
333 | 'is_default' => array( | |
334 | 'name' => 'is_default', | |
335 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
336 | 'title' => ts('Default Financial Account') , | |
337 | 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?', | |
522a26c9 | 338 | 'table_name' => 'civicrm_financial_account', |
339 | 'entity' => 'FinancialAccount', | |
340 | 'bao' => 'CRM_Financial_BAO_FinancialAccount', | |
e501603b | 341 | ) , |
e501603b | 342 | ); |
346aaaba | 343 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 344 | } |
346aaaba | 345 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
346 | } |
347 | /** | |
bd8e0b14 | 348 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
349 | * |
350 | * @return array | |
bd8e0b14 | 351 | * Array(string $name => string $uniqueName). |
e501603b TO |
352 | */ |
353 | static function &fieldKeys() { | |
bd8e0b14 TO |
354 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
355 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 356 | } |
bd8e0b14 | 357 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
358 | } |
359 | /** | |
360 | * Returns the names of this table | |
361 | * | |
362 | * @return string | |
363 | */ | |
364 | static function getTableName() { | |
365 | return self::$_tableName; | |
366 | } | |
367 | /** | |
368 | * Returns if this table needs to be logged | |
369 | * | |
370 | * @return boolean | |
371 | */ | |
372 | function getLog() { | |
373 | return self::$_log; | |
374 | } | |
375 | /** | |
376 | * Returns the list of fields that can be imported | |
377 | * | |
378 | * @param bool $prefix | |
379 | * | |
380 | * @return array | |
381 | */ | |
382 | static function &import($prefix = false) { | |
60808919 TO |
383 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_account', $prefix, array()); |
384 | return $r; | |
e501603b TO |
385 | } |
386 | /** | |
387 | * Returns the list of fields that can be exported | |
388 | * | |
389 | * @param bool $prefix | |
390 | * | |
391 | * @return array | |
392 | */ | |
393 | static function &export($prefix = false) { | |
60808919 TO |
394 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_account', $prefix, array()); |
395 | return $r; | |
e501603b TO |
396 | } |
397 | } |