5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Financial/FinancialAccount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e9c9d66596703d9dfbf411034ce909c4)
13 * Database access object for the FinancialAccount entity.
15 class CRM_Financial_DAO_FinancialAccount
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_financial_account';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Financial Account Name.
46 * FK to Contact ID that is responsible for the funds in this account
53 * pseudo FK into civicrm_option_value.
57 public $financial_account_type_id;
60 * Optional value for mapping monies owed and received to accounting system codes.
64 public $accounting_code;
67 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
71 public $account_type_code;
74 * Financial Type Description.
81 * Parent ID in account hierarchy
88 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
92 public $is_header_account;
95 * Is this account tax-deductible?
99 public $is_deductible;
102 * Is this account for taxes?
109 * The percentage of the total_amount that is due for this tax.
116 * Is this a predefined system object?
123 * Is this property active?
130 * Is this account the default one (or default tax one) for its financial_account_type?
139 public function __construct() {
140 $this->__table
= 'civicrm_financial_account';
141 parent
::__construct();
145 * Returns localized title of this entity.
147 public static function getEntityTitle() {
148 return ts('Financial Accounts');
152 * Returns foreign keys and entity references.
155 * [CRM_Core_Reference_Interface]
157 public static function getReferenceColumns() {
158 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
159 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
160 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
161 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_financial_account', 'id');
162 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
164 return Civi
::$statics[__CLASS__
]['links'];
168 * Returns all the column names of this table
172 public static function &fields() {
173 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
174 Civi
::$statics[__CLASS__
]['fields'] = [
177 'type' => CRM_Utils_Type
::T_INT
,
178 'title' => ts('Financial Account ID'),
179 'description' => ts('ID'),
181 'where' => 'civicrm_financial_account.id',
182 'table_name' => 'civicrm_financial_account',
183 'entity' => 'FinancialAccount',
184 'bao' => 'CRM_Financial_BAO_FinancialAccount',
190 'type' => CRM_Utils_Type
::T_STRING
,
191 'title' => ts('Financial Account Name'),
192 'description' => ts('Financial Account Name.'),
195 'size' => CRM_Utils_Type
::HUGE
,
196 'where' => 'civicrm_financial_account.name',
197 'table_name' => 'civicrm_financial_account',
198 'entity' => 'FinancialAccount',
199 'bao' => 'CRM_Financial_BAO_FinancialAccount',
203 'financial_account_contact_id' => [
204 'name' => 'contact_id',
205 'type' => CRM_Utils_Type
::T_INT
,
206 'title' => ts('Contact ID'),
207 'description' => ts('FK to Contact ID that is responsible for the funds in this account'),
208 'where' => 'civicrm_financial_account.contact_id',
209 'table_name' => 'civicrm_financial_account',
210 'entity' => 'FinancialAccount',
211 'bao' => 'CRM_Financial_BAO_FinancialAccount',
213 'FKClassName' => 'CRM_Contact_DAO_Contact',
216 'financial_account_type_id' => [
217 'name' => 'financial_account_type_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Financial Account Type'),
220 'description' => ts('pseudo FK into civicrm_option_value.'),
222 'where' => 'civicrm_financial_account.financial_account_type_id',
224 'table_name' => 'civicrm_financial_account',
225 'entity' => 'FinancialAccount',
226 'bao' => 'CRM_Financial_BAO_FinancialAccount',
231 'pseudoconstant' => [
232 'optionGroupName' => 'financial_account_type',
233 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
237 'accounting_code' => [
238 'name' => 'accounting_code',
239 'type' => CRM_Utils_Type
::T_STRING
,
240 'title' => ts('Accounting Code'),
241 'description' => ts('Optional value for mapping monies owed and received to accounting system codes.'),
243 'size' => CRM_Utils_Type
::BIG
,
244 'where' => 'civicrm_financial_account.accounting_code',
246 'table_name' => 'civicrm_financial_account',
247 'entity' => 'FinancialAccount',
248 'bao' => 'CRM_Financial_BAO_FinancialAccount',
252 'account_type_code' => [
253 'name' => 'account_type_code',
254 'type' => CRM_Utils_Type
::T_STRING
,
255 'title' => ts('Account Type Code'),
256 'description' => ts('Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).'),
258 'size' => CRM_Utils_Type
::BIG
,
259 'where' => 'civicrm_financial_account.account_type_code',
261 'table_name' => 'civicrm_financial_account',
262 'entity' => 'FinancialAccount',
263 'bao' => 'CRM_Financial_BAO_FinancialAccount',
268 'name' => 'description',
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Financial Account Description'),
271 'description' => ts('Financial Type Description.'),
273 'size' => CRM_Utils_Type
::HUGE
,
274 'where' => 'civicrm_financial_account.description',
275 'table_name' => 'civicrm_financial_account',
276 'entity' => 'FinancialAccount',
277 'bao' => 'CRM_Financial_BAO_FinancialAccount',
282 'name' => 'parent_id',
283 'type' => CRM_Utils_Type
::T_INT
,
284 'title' => ts('Financial Account Parent'),
285 'description' => ts('Parent ID in account hierarchy'),
286 'where' => 'civicrm_financial_account.parent_id',
287 'table_name' => 'civicrm_financial_account',
288 'entity' => 'FinancialAccount',
289 'bao' => 'CRM_Financial_BAO_FinancialAccount',
291 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
294 'is_header_account' => [
295 'name' => 'is_header_account',
296 'type' => CRM_Utils_Type
::T_BOOLEAN
,
297 'title' => ts('Header Financial Account?'),
298 'description' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
299 'where' => 'civicrm_financial_account.is_header_account',
301 'table_name' => 'civicrm_financial_account',
302 'entity' => 'FinancialAccount',
303 'bao' => 'CRM_Financial_BAO_FinancialAccount',
308 'name' => 'is_deductible',
309 'type' => CRM_Utils_Type
::T_BOOLEAN
,
310 'title' => ts('Deductible Financial Account?'),
311 'description' => ts('Is this account tax-deductible?'),
312 'where' => 'civicrm_financial_account.is_deductible',
314 'table_name' => 'civicrm_financial_account',
315 'entity' => 'FinancialAccount',
316 'bao' => 'CRM_Financial_BAO_FinancialAccount',
322 'type' => CRM_Utils_Type
::T_BOOLEAN
,
323 'title' => ts('Tax Financial Account?'),
324 'description' => ts('Is this account for taxes?'),
325 'where' => 'civicrm_financial_account.is_tax',
327 'table_name' => 'civicrm_financial_account',
328 'entity' => 'FinancialAccount',
329 'bao' => 'CRM_Financial_BAO_FinancialAccount',
334 'name' => 'tax_rate',
335 'type' => CRM_Utils_Type
::T_MONEY
,
336 'title' => ts('Financial Account Tax Rate'),
337 'description' => ts('The percentage of the total_amount that is due for this tax.'),
342 'where' => 'civicrm_financial_account.tax_rate',
343 'table_name' => 'civicrm_financial_account',
344 'entity' => 'FinancialAccount',
345 'bao' => 'CRM_Financial_BAO_FinancialAccount',
350 'name' => 'is_reserved',
351 'type' => CRM_Utils_Type
::T_BOOLEAN
,
352 'title' => ts('Reserved Financial Account?'),
353 'description' => ts('Is this a predefined system object?'),
354 'where' => 'civicrm_financial_account.is_reserved',
355 'table_name' => 'civicrm_financial_account',
356 'entity' => 'FinancialAccount',
357 'bao' => 'CRM_Financial_BAO_FinancialAccount',
362 'name' => 'is_active',
363 'type' => CRM_Utils_Type
::T_BOOLEAN
,
364 'title' => ts('Financial Account is Active'),
365 'description' => ts('Is this property active?'),
366 'where' => 'civicrm_financial_account.is_active',
367 'table_name' => 'civicrm_financial_account',
368 'entity' => 'FinancialAccount',
369 'bao' => 'CRM_Financial_BAO_FinancialAccount',
374 'name' => 'is_default',
375 'type' => CRM_Utils_Type
::T_BOOLEAN
,
376 'title' => ts('Default Financial Account'),
377 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
378 'where' => 'civicrm_financial_account.is_default',
379 'table_name' => 'civicrm_financial_account',
380 'entity' => 'FinancialAccount',
381 'bao' => 'CRM_Financial_BAO_FinancialAccount',
386 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
388 return Civi
::$statics[__CLASS__
]['fields'];
392 * Return a mapping from field-name to the corresponding key (as used in fields()).
395 * Array(string $name => string $uniqueName).
397 public static function &fieldKeys() {
398 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
399 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
401 return Civi
::$statics[__CLASS__
]['fieldKeys'];
405 * Returns the names of this table
409 public static function getTableName() {
410 return self
::$_tableName;
414 * Returns if this table needs to be logged
418 public function getLog() {
423 * Returns the list of fields that can be imported
425 * @param bool $prefix
429 public static function &import($prefix = FALSE) {
430 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
435 * Returns the list of fields that can be exported
437 * @param bool $prefix
441 public static function &export($prefix = FALSE) {
442 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
447 * Returns the list of indices
449 * @param bool $localize
453 public static function indices($localize = TRUE) {
460 'localizable' => FALSE,
462 'sig' => 'civicrm_financial_account::1::name',
465 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;