3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
31 * Generated from xml/schema/CRM/Financial/FinancialAccount.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:14d3715c48b20555e6bce4ff679cd251)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Financial_DAO_FinancialAccount constructor.
40 class CRM_Financial_DAO_FinancialAccount
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_financial_account';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * Financial Account Name.
66 * FK to Contact ID that is responsible for the funds in this account
72 * pseudo FK into civicrm_option_value.
76 public $financial_account_type_id;
78 * Optional value for mapping monies owed and received to accounting system codes.
82 public $accounting_code;
84 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
88 public $account_type_code;
90 * Financial Type Description.
96 * Parent ID in account hierarchy
102 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
106 public $is_header_account;
108 * Is this account tax-deductible?
112 public $is_deductible;
114 * Is this account for taxes?
120 * The percentage of the total_amount that is due for this tax.
126 * Is this a predefined system object?
132 * Is this property active?
138 * Is this account the default one (or default tax one) for its financial_account_type?
144 * Contains the opening balance for this financial account
148 public $opening_balance;
150 * Contains the opening balance for the current period for this financial account
154 public $current_period_opening_balance;
158 function __construct() {
159 $this->__table
= 'civicrm_financial_account';
160 parent
::__construct();
163 * Returns foreign keys and entity references.
166 * [CRM_Core_Reference_Interface]
168 static function getReferenceColumns() {
169 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
170 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
171 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'parent_id', 'civicrm_financial_account', 'id');
173 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
175 return Civi
::$statics[__CLASS__
]['links'];
178 * Returns all the column names of this table
182 static function &fields() {
183 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
184 Civi
::$statics[__CLASS__
]['fields'] = array(
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Financial Account ID') ,
189 'description' => 'ID',
191 'table_name' => 'civicrm_financial_account',
192 'entity' => 'FinancialAccount',
193 'bao' => 'CRM_Financial_BAO_FinancialAccount',
197 'type' => CRM_Utils_Type
::T_STRING
,
198 'title' => ts('Financial Account Name') ,
199 'description' => 'Financial Account Name.',
202 'size' => CRM_Utils_Type
::HUGE
,
203 'table_name' => 'civicrm_financial_account',
204 'entity' => 'FinancialAccount',
205 'bao' => 'CRM_Financial_BAO_FinancialAccount',
207 'financial_account_contact_id' => array(
208 'name' => 'contact_id',
209 'type' => CRM_Utils_Type
::T_INT
,
210 'title' => ts('Contact ID') ,
211 'description' => 'FK to Contact ID that is responsible for the funds in this account',
212 'table_name' => 'civicrm_financial_account',
213 'entity' => 'FinancialAccount',
214 'bao' => 'CRM_Financial_BAO_FinancialAccount',
215 'FKClassName' => 'CRM_Contact_DAO_Contact',
217 'financial_account_type_id' => array(
218 'name' => 'financial_account_type_id',
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Financial Account Type') ,
221 'description' => 'pseudo FK into civicrm_option_value.',
224 'table_name' => 'civicrm_financial_account',
225 'entity' => 'FinancialAccount',
226 'bao' => 'CRM_Financial_BAO_FinancialAccount',
230 'pseudoconstant' => array(
231 'optionGroupName' => 'financial_account_type',
232 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
235 'accounting_code' => array(
236 'name' => 'accounting_code',
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('Accounting Code') ,
239 'description' => 'Optional value for mapping monies owed and received to accounting system codes.',
241 'size' => CRM_Utils_Type
::BIG
,
243 'where' => 'civicrm_financial_account.accounting_code',
244 'headerPattern' => '',
246 'table_name' => 'civicrm_financial_account',
247 'entity' => 'FinancialAccount',
248 'bao' => 'CRM_Financial_BAO_FinancialAccount',
250 'account_type_code' => array(
251 'name' => 'account_type_code',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Account Type Code') ,
254 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).',
256 'size' => CRM_Utils_Type
::BIG
,
258 'where' => 'civicrm_financial_account.account_type_code',
259 'headerPattern' => '',
261 'table_name' => 'civicrm_financial_account',
262 'entity' => 'FinancialAccount',
263 'bao' => 'CRM_Financial_BAO_FinancialAccount',
265 'description' => array(
266 'name' => 'description',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Financial Account Description') ,
269 'description' => 'Financial Type Description.',
271 'size' => CRM_Utils_Type
::HUGE
,
272 'table_name' => 'civicrm_financial_account',
273 'entity' => 'FinancialAccount',
274 'bao' => 'CRM_Financial_BAO_FinancialAccount',
276 'parent_id' => array(
277 'name' => 'parent_id',
278 'type' => CRM_Utils_Type
::T_INT
,
279 'title' => ts('Financial Account Parent') ,
280 'description' => 'Parent ID in account hierarchy',
281 'table_name' => 'civicrm_financial_account',
282 'entity' => 'FinancialAccount',
283 'bao' => 'CRM_Financial_BAO_FinancialAccount',
284 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
286 'is_header_account' => array(
287 'name' => 'is_header_account',
288 'type' => CRM_Utils_Type
::T_BOOLEAN
,
289 'title' => ts('Header Financial Account?') ,
290 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
291 'table_name' => 'civicrm_financial_account',
292 'entity' => 'FinancialAccount',
293 'bao' => 'CRM_Financial_BAO_FinancialAccount',
295 'is_deductible' => array(
296 'name' => 'is_deductible',
297 'type' => CRM_Utils_Type
::T_BOOLEAN
,
298 'title' => ts('Deductible Financial Account?') ,
299 'description' => 'Is this account tax-deductible?',
301 'table_name' => 'civicrm_financial_account',
302 'entity' => 'FinancialAccount',
303 'bao' => 'CRM_Financial_BAO_FinancialAccount',
307 'type' => CRM_Utils_Type
::T_BOOLEAN
,
308 'title' => ts('Tax Financial Account?') ,
309 'description' => 'Is this account for taxes?',
310 'table_name' => 'civicrm_financial_account',
311 'entity' => 'FinancialAccount',
312 'bao' => 'CRM_Financial_BAO_FinancialAccount',
315 'name' => 'tax_rate',
316 'type' => CRM_Utils_Type
::T_MONEY
,
317 'title' => ts('Financial Account Tax Rate') ,
318 'description' => 'The percentage of the total_amount that is due for this tax.',
319 'precision' => array(
323 'table_name' => 'civicrm_financial_account',
324 'entity' => 'FinancialAccount',
325 'bao' => 'CRM_Financial_BAO_FinancialAccount',
327 'is_reserved' => array(
328 'name' => 'is_reserved',
329 'type' => CRM_Utils_Type
::T_BOOLEAN
,
330 'title' => ts('Reserved Financial Account?') ,
331 'description' => 'Is this a predefined system object?',
332 'table_name' => 'civicrm_financial_account',
333 'entity' => 'FinancialAccount',
334 'bao' => 'CRM_Financial_BAO_FinancialAccount',
336 'is_active' => array(
337 'name' => 'is_active',
338 'type' => CRM_Utils_Type
::T_BOOLEAN
,
339 'title' => ts('Financial Account is Active') ,
340 'description' => 'Is this property active?',
341 'table_name' => 'civicrm_financial_account',
342 'entity' => 'FinancialAccount',
343 'bao' => 'CRM_Financial_BAO_FinancialAccount',
345 'is_default' => array(
346 'name' => 'is_default',
347 'type' => CRM_Utils_Type
::T_BOOLEAN
,
348 'title' => ts('Default Financial Account') ,
349 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?',
350 'table_name' => 'civicrm_financial_account',
351 'entity' => 'FinancialAccount',
352 'bao' => 'CRM_Financial_BAO_FinancialAccount',
354 'opening_balance' => array(
355 'name' => 'opening_balance',
356 'type' => CRM_Utils_Type
::T_MONEY
,
357 'title' => ts('Opening Balance') ,
358 'description' => 'Contains the opening balance for this financial account',
359 'precision' => array(
363 'table_name' => 'civicrm_financial_account',
364 'entity' => 'FinancialAccount',
365 'bao' => 'CRM_Financial_BAO_FinancialAccount',
367 'current_period_opening_balance' => array(
368 'name' => 'current_period_opening_balance',
369 'type' => CRM_Utils_Type
::T_MONEY
,
370 'title' => ts('Current period opening Balance') ,
371 'description' => 'Contains the opening balance for the current period for this financial account',
372 'precision' => array(
376 'table_name' => 'civicrm_financial_account',
377 'entity' => 'FinancialAccount',
378 'bao' => 'CRM_Financial_BAO_FinancialAccount',
381 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
383 return Civi
::$statics[__CLASS__
]['fields'];
386 * Return a mapping from field-name to the corresponding key (as used in fields()).
389 * Array(string $name => string $uniqueName).
391 static function &fieldKeys() {
392 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
393 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
395 return Civi
::$statics[__CLASS__
]['fieldKeys'];
398 * Returns the names of this table
402 static function getTableName() {
403 return self
::$_tableName;
406 * Returns if this table needs to be logged
414 * Returns the list of fields that can be imported
416 * @param bool $prefix
420 static function &import($prefix = false) {
421 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, array());
425 * Returns the list of fields that can be exported
427 * @param bool $prefix
431 static function &export($prefix = false) {
432 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, array());