3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2016
31 * Generated from xml/schema/CRM/Financial/FinancialAccount.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:81859ed9d8791350520d6697aefcd0ab)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Financial_DAO_FinancialAccount
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_financial_account';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
90 * Financial Account Name.
96 * FK to Contact ID that is responsible for the funds in this account
102 * pseudo FK into civicrm_option_value.
106 public $financial_account_type_id;
108 * Optional value for mapping monies owed and received to accounting system codes.
112 public $accounting_code;
114 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
118 public $account_type_code;
120 * Financial Type Description.
126 * Parent ID in account hierarchy
132 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
136 public $is_header_account;
138 * Is this account tax-deductible?
142 public $is_deductible;
144 * Is this account for taxes?
150 * The percentage of the total_amount that is due for this tax.
156 * Is this a predefined system object?
162 * Is this property active?
168 * Is this account the default one (or default tax one) for its financial_account_type?
174 * Contains the opening balance for this financial account
178 public $opening_balance;
180 * Contains the opening balance for the current period for this financial account
184 public $current_period_opening_balance;
188 * @return civicrm_financial_account
190 function __construct() {
191 $this->__table
= 'civicrm_financial_account';
192 parent
::__construct();
195 * Returns foreign keys and entity references
198 * [CRM_Core_Reference_Interface]
200 static function getReferenceColumns() {
201 if (!self
::$_links) {
202 self
::$_links = static ::createReferenceColumns(__CLASS__
);
203 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
204 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'parent_id', 'civicrm_financial_account', 'id');
206 return self
::$_links;
209 * Returns all the column names of this table
213 static function &fields() {
214 if (!(self
::$_fields)) {
215 self
::$_fields = array(
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Financial Account ID') ,
220 'description' => 'ID',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Financial Account Name') ,
227 'description' => 'Financial Account Name.',
230 'size' => CRM_Utils_Type
::HUGE
,
232 'financial_account_contact_id' => array(
233 'name' => 'contact_id',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Contact ID') ,
236 'description' => 'FK to Contact ID that is responsible for the funds in this account',
237 'FKClassName' => 'CRM_Contact_DAO_Contact',
239 'financial_account_type_id' => array(
240 'name' => 'financial_account_type_id',
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Financial Account Type') ,
243 'description' => 'pseudo FK into civicrm_option_value.',
249 'pseudoconstant' => array(
250 'optionGroupName' => 'financial_account_type',
251 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
254 'accounting_code' => array(
255 'name' => 'accounting_code',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Accounting Code') ,
258 'description' => 'Optional value for mapping monies owed and received to accounting system codes.',
260 'size' => CRM_Utils_Type
::BIG
,
262 'where' => 'civicrm_financial_account.accounting_code',
263 'headerPattern' => '',
266 'account_type_code' => array(
267 'name' => 'account_type_code',
268 'type' => CRM_Utils_Type
::T_STRING
,
269 'title' => ts('Account Type Code') ,
270 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).',
272 'size' => CRM_Utils_Type
::BIG
,
274 'where' => 'civicrm_financial_account.account_type_code',
275 'headerPattern' => '',
278 'description' => array(
279 'name' => 'description',
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('Financial Account Description') ,
282 'description' => 'Financial Type Description.',
284 'size' => CRM_Utils_Type
::HUGE
,
286 'parent_id' => array(
287 'name' => 'parent_id',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('Financial Account Parent') ,
290 'description' => 'Parent ID in account hierarchy',
291 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
293 'is_header_account' => array(
294 'name' => 'is_header_account',
295 'type' => CRM_Utils_Type
::T_BOOLEAN
,
296 'title' => ts('Header Financial Account?') ,
297 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
299 'is_deductible' => array(
300 'name' => 'is_deductible',
301 'type' => CRM_Utils_Type
::T_BOOLEAN
,
302 'title' => ts('Deductible Financial Account?') ,
303 'description' => 'Is this account tax-deductible?',
308 'type' => CRM_Utils_Type
::T_BOOLEAN
,
309 'title' => ts('Tax Financial Account?') ,
310 'description' => 'Is this account for taxes?',
313 'name' => 'tax_rate',
314 'type' => CRM_Utils_Type
::T_MONEY
,
315 'title' => ts('Financial Account Tax Rate') ,
316 'description' => 'The percentage of the total_amount that is due for this tax.',
317 'precision' => array(
322 'is_reserved' => array(
323 'name' => 'is_reserved',
324 'type' => CRM_Utils_Type
::T_BOOLEAN
,
325 'title' => ts('Reserved Financial Account?') ,
326 'description' => 'Is this a predefined system object?',
328 'is_active' => array(
329 'name' => 'is_active',
330 'type' => CRM_Utils_Type
::T_BOOLEAN
,
331 'title' => ts('Financial Account is Active') ,
332 'description' => 'Is this property active?',
334 'is_default' => array(
335 'name' => 'is_default',
336 'type' => CRM_Utils_Type
::T_BOOLEAN
,
337 'title' => ts('Default Financial Account') ,
338 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?',
340 'opening_balance' => array(
341 'name' => 'opening_balance',
342 'type' => CRM_Utils_Type
::T_MONEY
,
343 'title' => ts('Opening Balance') ,
344 'description' => 'Contains the opening balance for this financial account',
345 'precision' => array(
350 'current_period_opening_balance' => array(
351 'name' => 'current_period_opening_balance',
352 'type' => CRM_Utils_Type
::T_MONEY
,
353 'title' => ts('Current period opening Balance') ,
354 'description' => 'Contains the opening balance for the current period for this financial account',
355 'precision' => array(
362 return self
::$_fields;
365 * Returns an array containing, for each field, the arary key used for that
366 * field in self::$_fields.
370 static function &fieldKeys() {
371 if (!(self
::$_fieldKeys)) {
372 self
::$_fieldKeys = array(
375 'contact_id' => 'financial_account_contact_id',
376 'financial_account_type_id' => 'financial_account_type_id',
377 'accounting_code' => 'accounting_code',
378 'account_type_code' => 'account_type_code',
379 'description' => 'description',
380 'parent_id' => 'parent_id',
381 'is_header_account' => 'is_header_account',
382 'is_deductible' => 'is_deductible',
383 'is_tax' => 'is_tax',
384 'tax_rate' => 'tax_rate',
385 'is_reserved' => 'is_reserved',
386 'is_active' => 'is_active',
387 'is_default' => 'is_default',
388 'opening_balance' => 'opening_balance',
389 'current_period_opening_balance' => 'current_period_opening_balance',
392 return self
::$_fieldKeys;
395 * Returns the names of this table
399 static function getTableName() {
400 return self
::$_tableName;
403 * Returns if this table needs to be logged
411 * Returns the list of fields that can be imported
413 * @param bool $prefix
417 static function &import($prefix = false) {
418 if (!(self
::$_import)) {
419 self
::$_import = array();
420 $fields = self
::fields();
421 foreach($fields as $name => $field) {
422 if (CRM_Utils_Array
::value('import', $field)) {
424 self
::$_import['financial_account'] = & $fields[$name];
426 self
::$_import[$name] = & $fields[$name];
431 return self
::$_import;
434 * Returns the list of fields that can be exported
436 * @param bool $prefix
440 static function &export($prefix = false) {
441 if (!(self
::$_export)) {
442 self
::$_export = array();
443 $fields = self
::fields();
444 foreach($fields as $name => $field) {
445 if (CRM_Utils_Array
::value('export', $field)) {
447 self
::$_export['financial_account'] = & $fields[$name];
449 self
::$_export[$name] = & $fields[$name];
454 return self
::$_export;