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:4b1497d1607b10f8eec89c101665cd1d)
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?
146 function __construct() {
147 $this->__table
= 'civicrm_financial_account';
148 parent
::__construct();
151 * Returns foreign keys and entity references.
154 * [CRM_Core_Reference_Interface]
156 static function getReferenceColumns() {
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']);
163 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = array(
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Financial Account ID') ,
177 'description' => 'ID',
179 'table_name' => 'civicrm_financial_account',
180 'entity' => 'FinancialAccount',
181 'bao' => 'CRM_Financial_BAO_FinancialAccount',
186 'type' => CRM_Utils_Type
::T_STRING
,
187 'title' => ts('Financial Account Name') ,
188 'description' => 'Financial Account Name.',
191 'size' => CRM_Utils_Type
::HUGE
,
192 'table_name' => 'civicrm_financial_account',
193 'entity' => 'FinancialAccount',
194 'bao' => 'CRM_Financial_BAO_FinancialAccount',
197 'financial_account_contact_id' => array(
198 'name' => 'contact_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Contact ID') ,
201 'description' => 'FK to Contact ID that is responsible for the funds in this account',
202 'table_name' => 'civicrm_financial_account',
203 'entity' => 'FinancialAccount',
204 'bao' => 'CRM_Financial_BAO_FinancialAccount',
206 'FKClassName' => 'CRM_Contact_DAO_Contact',
208 'financial_account_type_id' => array(
209 'name' => 'financial_account_type_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Financial Account Type') ,
212 'description' => 'pseudo FK into civicrm_option_value.',
215 'table_name' => 'civicrm_financial_account',
216 'entity' => 'FinancialAccount',
217 'bao' => 'CRM_Financial_BAO_FinancialAccount',
222 'pseudoconstant' => array(
223 'optionGroupName' => 'financial_account_type',
224 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
227 'accounting_code' => array(
228 'name' => 'accounting_code',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('Accounting Code') ,
231 'description' => 'Optional value for mapping monies owed and received to accounting system codes.',
233 'size' => CRM_Utils_Type
::BIG
,
235 'where' => 'civicrm_financial_account.accounting_code',
236 'headerPattern' => '',
238 'table_name' => 'civicrm_financial_account',
239 'entity' => 'FinancialAccount',
240 'bao' => 'CRM_Financial_BAO_FinancialAccount',
243 'account_type_code' => array(
244 'name' => 'account_type_code',
245 'type' => CRM_Utils_Type
::T_STRING
,
246 'title' => ts('Account Type Code') ,
247 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).',
249 'size' => CRM_Utils_Type
::BIG
,
251 'where' => 'civicrm_financial_account.account_type_code',
252 'headerPattern' => '',
254 'table_name' => 'civicrm_financial_account',
255 'entity' => 'FinancialAccount',
256 'bao' => 'CRM_Financial_BAO_FinancialAccount',
259 'description' => array(
260 'name' => 'description',
261 'type' => CRM_Utils_Type
::T_STRING
,
262 'title' => ts('Financial Account Description') ,
263 'description' => 'Financial Type Description.',
265 'size' => CRM_Utils_Type
::HUGE
,
266 'table_name' => 'civicrm_financial_account',
267 'entity' => 'FinancialAccount',
268 'bao' => 'CRM_Financial_BAO_FinancialAccount',
271 'parent_id' => array(
272 'name' => 'parent_id',
273 'type' => CRM_Utils_Type
::T_INT
,
274 'title' => ts('Financial Account Parent') ,
275 'description' => 'Parent ID in account hierarchy',
276 'table_name' => 'civicrm_financial_account',
277 'entity' => 'FinancialAccount',
278 'bao' => 'CRM_Financial_BAO_FinancialAccount',
280 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
282 'is_header_account' => array(
283 'name' => 'is_header_account',
284 'type' => CRM_Utils_Type
::T_BOOLEAN
,
285 'title' => ts('Header Financial Account?') ,
286 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
287 'table_name' => 'civicrm_financial_account',
288 'entity' => 'FinancialAccount',
289 'bao' => 'CRM_Financial_BAO_FinancialAccount',
292 'is_deductible' => array(
293 'name' => 'is_deductible',
294 'type' => CRM_Utils_Type
::T_BOOLEAN
,
295 'title' => ts('Deductible Financial Account?') ,
296 'description' => 'Is this account tax-deductible?',
298 'table_name' => 'civicrm_financial_account',
299 'entity' => 'FinancialAccount',
300 'bao' => 'CRM_Financial_BAO_FinancialAccount',
305 'type' => CRM_Utils_Type
::T_BOOLEAN
,
306 'title' => ts('Tax Financial Account?') ,
307 'description' => 'Is this account for taxes?',
308 'table_name' => 'civicrm_financial_account',
309 'entity' => 'FinancialAccount',
310 'bao' => 'CRM_Financial_BAO_FinancialAccount',
314 'name' => 'tax_rate',
315 'type' => CRM_Utils_Type
::T_MONEY
,
316 'title' => ts('Financial Account Tax Rate') ,
317 'description' => 'The percentage of the total_amount that is due for this tax.',
318 'precision' => array(
322 'table_name' => 'civicrm_financial_account',
323 'entity' => 'FinancialAccount',
324 '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',
337 'is_active' => array(
338 'name' => 'is_active',
339 'type' => CRM_Utils_Type
::T_BOOLEAN
,
340 'title' => ts('Financial Account is Active') ,
341 'description' => 'Is this property active?',
342 'table_name' => 'civicrm_financial_account',
343 'entity' => 'FinancialAccount',
344 'bao' => 'CRM_Financial_BAO_FinancialAccount',
347 'is_default' => array(
348 'name' => 'is_default',
349 'type' => CRM_Utils_Type
::T_BOOLEAN
,
350 'title' => ts('Default Financial Account') ,
351 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?',
352 'table_name' => 'civicrm_financial_account',
353 'entity' => 'FinancialAccount',
354 'bao' => 'CRM_Financial_BAO_FinancialAccount',
358 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
360 return Civi
::$statics[__CLASS__
]['fields'];
363 * Return a mapping from field-name to the corresponding key (as used in fields()).
366 * Array(string $name => string $uniqueName).
368 static function &fieldKeys() {
369 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
370 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
372 return Civi
::$statics[__CLASS__
]['fieldKeys'];
375 * Returns the names of this table
379 static function getTableName() {
380 return self
::$_tableName;
383 * Returns if this table needs to be logged
391 * Returns the list of fields that can be imported
393 * @param bool $prefix
397 static function &import($prefix = false) {
398 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, array());
402 * Returns the list of fields that can be exported
404 * @param bool $prefix
408 static function &export($prefix = false) {
409 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, array());
413 * Returns the list of indices
415 public static function indices($localize = TRUE) {
422 'localizable' => false,
424 'sig' => 'civicrm_financial_account::1::name',
427 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;