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:f8ca05b54a4b94d2636d0da894b7236f)
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 value to see if we should log any modifications to
64 * this table in the civicrm_log table
76 * Financial Account Name.
82 * FK to Contact ID that is responsible for the funds in this account
88 * pseudo FK into civicrm_option_value.
92 public $financial_account_type_id;
94 * Optional value for mapping monies owed and received to accounting system codes.
98 public $accounting_code;
100 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
104 public $account_type_code;
106 * Financial Type Description.
112 * Parent ID in account hierarchy
118 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
122 public $is_header_account;
124 * Is this account tax-deductible?
128 public $is_deductible;
130 * Is this account for taxes?
136 * The percentage of the total_amount that is due for this tax.
142 * Is this a predefined system object?
148 * Is this property active?
154 * Is this account the default one (or default tax one) for its financial_account_type?
160 * Contains the opening balance for this financial account
164 public $opening_balance;
166 * Contains the opening balance for the current period for this financial account
170 public $current_period_opening_balance;
174 * @return civicrm_financial_account
176 function __construct() {
177 $this->__table
= 'civicrm_financial_account';
178 parent
::__construct();
181 * Returns foreign keys and entity references
184 * [CRM_Core_Reference_Interface]
186 static function getReferenceColumns() {
187 if (!self
::$_links) {
188 self
::$_links = static ::createReferenceColumns(__CLASS__
);
189 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
190 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'parent_id', 'civicrm_financial_account', 'id');
192 return self
::$_links;
195 * Returns all the column names of this table
199 static function &fields() {
200 if (!(self
::$_fields)) {
201 self
::$_fields = array(
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Financial Account ID') ,
206 'description' => 'ID',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Financial Account Name') ,
213 'description' => 'Financial Account Name.',
216 'size' => CRM_Utils_Type
::HUGE
,
218 'financial_account_contact_id' => array(
219 'name' => 'contact_id',
220 'type' => CRM_Utils_Type
::T_INT
,
221 'title' => ts('Contact ID') ,
222 'description' => 'FK to Contact ID that is responsible for the funds in this account',
223 'FKClassName' => 'CRM_Contact_DAO_Contact',
225 'financial_account_type_id' => array(
226 'name' => 'financial_account_type_id',
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Financial Account Type') ,
229 'description' => 'pseudo FK into civicrm_option_value.',
235 'pseudoconstant' => array(
236 'optionGroupName' => 'financial_account_type',
237 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
240 'accounting_code' => array(
241 'name' => 'accounting_code',
242 'type' => CRM_Utils_Type
::T_STRING
,
243 'title' => ts('Accounting Code') ,
244 'description' => 'Optional value for mapping monies owed and received to accounting system codes.',
246 'size' => CRM_Utils_Type
::BIG
,
248 'where' => 'civicrm_financial_account.accounting_code',
249 'headerPattern' => '',
252 'account_type_code' => array(
253 'name' => 'account_type_code',
254 'type' => CRM_Utils_Type
::T_STRING
,
255 'title' => ts('Account Type Code') ,
256 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).',
258 'size' => CRM_Utils_Type
::BIG
,
260 'where' => 'civicrm_financial_account.account_type_code',
261 'headerPattern' => '',
264 'description' => array(
265 'name' => 'description',
266 'type' => CRM_Utils_Type
::T_STRING
,
267 'title' => ts('Financial Account Description') ,
268 'description' => 'Financial Type Description.',
270 'size' => CRM_Utils_Type
::HUGE
,
272 'parent_id' => array(
273 'name' => 'parent_id',
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Financial Account Parent') ,
276 'description' => 'Parent ID in account hierarchy',
277 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
279 'is_header_account' => array(
280 'name' => 'is_header_account',
281 'type' => CRM_Utils_Type
::T_BOOLEAN
,
282 'title' => ts('Header Financial Account?') ,
283 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
285 'is_deductible' => array(
286 'name' => 'is_deductible',
287 'type' => CRM_Utils_Type
::T_BOOLEAN
,
288 'title' => ts('Deductible Financial Account?') ,
289 'description' => 'Is this account tax-deductible?',
294 'type' => CRM_Utils_Type
::T_BOOLEAN
,
295 'title' => ts('Tax Financial Account?') ,
296 'description' => 'Is this account for taxes?',
299 'name' => 'tax_rate',
300 'type' => CRM_Utils_Type
::T_MONEY
,
301 'title' => ts('Financial Account Tax Rate') ,
302 'description' => 'The percentage of the total_amount that is due for this tax.',
303 'precision' => array(
308 'is_reserved' => array(
309 'name' => 'is_reserved',
310 'type' => CRM_Utils_Type
::T_BOOLEAN
,
311 'title' => ts('Reserved Financial Account?') ,
312 'description' => 'Is this a predefined system object?',
314 'is_active' => array(
315 'name' => 'is_active',
316 'type' => CRM_Utils_Type
::T_BOOLEAN
,
317 'title' => ts('Financial Account is Active') ,
318 'description' => 'Is this property active?',
320 'is_default' => array(
321 'name' => 'is_default',
322 'type' => CRM_Utils_Type
::T_BOOLEAN
,
323 'title' => ts('Default Financial Account') ,
324 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?',
326 'opening_balance' => array(
327 'name' => 'opening_balance',
328 'type' => CRM_Utils_Type
::T_MONEY
,
329 'title' => ts('Opening Balance') ,
330 'description' => 'Contains the opening balance for this financial account',
331 'precision' => array(
336 'current_period_opening_balance' => array(
337 'name' => 'current_period_opening_balance',
338 'type' => CRM_Utils_Type
::T_MONEY
,
339 'title' => ts('Current period opening Balance') ,
340 'description' => 'Contains the opening balance for the current period for this financial account',
341 'precision' => array(
348 return self
::$_fields;
351 * Returns an array containing, for each field, the arary key used for that
352 * field in self::$_fields.
356 static function &fieldKeys() {
357 if (!(self
::$_fieldKeys)) {
358 self
::$_fieldKeys = array(
361 'contact_id' => 'financial_account_contact_id',
362 'financial_account_type_id' => 'financial_account_type_id',
363 'accounting_code' => 'accounting_code',
364 'account_type_code' => 'account_type_code',
365 'description' => 'description',
366 'parent_id' => 'parent_id',
367 'is_header_account' => 'is_header_account',
368 'is_deductible' => 'is_deductible',
369 'is_tax' => 'is_tax',
370 'tax_rate' => 'tax_rate',
371 'is_reserved' => 'is_reserved',
372 'is_active' => 'is_active',
373 'is_default' => 'is_default',
374 'opening_balance' => 'opening_balance',
375 'current_period_opening_balance' => 'current_period_opening_balance',
378 return self
::$_fieldKeys;
381 * Returns the names of this table
385 static function getTableName() {
386 return self
::$_tableName;
389 * Returns if this table needs to be logged
397 * Returns the list of fields that can be imported
399 * @param bool $prefix
403 static function &import($prefix = false) {
404 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, array());
408 * Returns the list of fields that can be exported
410 * @param bool $prefix
414 static function &export($prefix = false) {
415 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, array());