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:b9f200ff95d9186180eff484dcd12a57)
13 * Database access object for the FinancialAccount entity.
15 class CRM_Financial_DAO_FinancialAccount
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_financial_account';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
41 * Financial Account Name.
48 * FK to Contact ID that is responsible for the funds in this account
55 * pseudo FK into civicrm_option_value.
59 public $financial_account_type_id;
62 * Optional value for mapping monies owed and received to accounting system codes.
66 public $accounting_code;
69 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
73 public $account_type_code;
76 * Financial Type Description.
83 * Parent ID in account hierarchy
90 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
94 public $is_header_account;
97 * Is this account tax-deductible?
101 public $is_deductible;
104 * Is this account for taxes?
111 * The percentage of the total_amount that is due for this tax.
118 * Is this a predefined system object?
125 * Is this property active?
132 * Is this account the default one (or default tax one) for its financial_account_type?
141 public function __construct() {
142 $this->__table
= 'civicrm_financial_account';
143 parent
::__construct();
147 * Returns localized title of this entity.
149 public static function getEntityTitle() {
150 return ts('Financial Accounts');
154 * Returns foreign keys and entity references.
157 * [CRM_Core_Reference_Interface]
159 public static function getReferenceColumns() {
160 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
161 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
162 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
163 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_financial_account', 'id');
164 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
166 return Civi
::$statics[__CLASS__
]['links'];
170 * Returns all the column names of this table
174 public static function &fields() {
175 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
176 Civi
::$statics[__CLASS__
]['fields'] = [
179 'type' => CRM_Utils_Type
::T_INT
,
180 'title' => ts('Financial Account ID'),
181 'description' => ts('ID'),
183 'where' => 'civicrm_financial_account.id',
184 'table_name' => 'civicrm_financial_account',
185 'entity' => 'FinancialAccount',
186 'bao' => 'CRM_Financial_BAO_FinancialAccount',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('Financial Account Name'),
194 'description' => ts('Financial Account Name.'),
197 'size' => CRM_Utils_Type
::HUGE
,
198 'where' => 'civicrm_financial_account.name',
199 'table_name' => 'civicrm_financial_account',
200 'entity' => 'FinancialAccount',
201 'bao' => 'CRM_Financial_BAO_FinancialAccount',
205 'financial_account_contact_id' => [
206 'name' => 'contact_id',
207 'type' => CRM_Utils_Type
::T_INT
,
208 'title' => ts('Contact ID'),
209 'description' => ts('FK to Contact ID that is responsible for the funds in this account'),
210 'where' => 'civicrm_financial_account.contact_id',
211 'table_name' => 'civicrm_financial_account',
212 'entity' => 'FinancialAccount',
213 'bao' => 'CRM_Financial_BAO_FinancialAccount',
215 'FKClassName' => 'CRM_Contact_DAO_Contact',
218 'financial_account_type_id' => [
219 'name' => 'financial_account_type_id',
220 'type' => CRM_Utils_Type
::T_INT
,
221 'title' => ts('Financial Account Type'),
222 'description' => ts('pseudo FK into civicrm_option_value.'),
224 'where' => 'civicrm_financial_account.financial_account_type_id',
226 'table_name' => 'civicrm_financial_account',
227 'entity' => 'FinancialAccount',
228 'bao' => 'CRM_Financial_BAO_FinancialAccount',
233 'pseudoconstant' => [
234 'optionGroupName' => 'financial_account_type',
235 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
239 'accounting_code' => [
240 'name' => 'accounting_code',
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Accounting Code'),
243 'description' => ts('Optional value for mapping monies owed and received to accounting system codes.'),
245 'size' => CRM_Utils_Type
::BIG
,
246 'where' => 'civicrm_financial_account.accounting_code',
248 'table_name' => 'civicrm_financial_account',
249 'entity' => 'FinancialAccount',
250 'bao' => 'CRM_Financial_BAO_FinancialAccount',
254 'account_type_code' => [
255 'name' => 'account_type_code',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Account Type Code'),
258 'description' => ts('Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).'),
260 'size' => CRM_Utils_Type
::BIG
,
261 'where' => 'civicrm_financial_account.account_type_code',
263 'table_name' => 'civicrm_financial_account',
264 'entity' => 'FinancialAccount',
265 'bao' => 'CRM_Financial_BAO_FinancialAccount',
270 'name' => 'description',
271 'type' => CRM_Utils_Type
::T_STRING
,
272 'title' => ts('Financial Account Description'),
273 'description' => ts('Financial Type Description.'),
275 'size' => CRM_Utils_Type
::HUGE
,
276 'where' => 'civicrm_financial_account.description',
277 'table_name' => 'civicrm_financial_account',
278 'entity' => 'FinancialAccount',
279 'bao' => 'CRM_Financial_BAO_FinancialAccount',
284 'name' => 'parent_id',
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Financial Account Parent'),
287 'description' => ts('Parent ID in account hierarchy'),
288 'where' => 'civicrm_financial_account.parent_id',
289 'table_name' => 'civicrm_financial_account',
290 'entity' => 'FinancialAccount',
291 'bao' => 'CRM_Financial_BAO_FinancialAccount',
293 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
296 'is_header_account' => [
297 'name' => 'is_header_account',
298 'type' => CRM_Utils_Type
::T_BOOLEAN
,
299 'title' => ts('Header Financial Account?'),
300 'description' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
301 'where' => 'civicrm_financial_account.is_header_account',
303 'table_name' => 'civicrm_financial_account',
304 'entity' => 'FinancialAccount',
305 'bao' => 'CRM_Financial_BAO_FinancialAccount',
310 'name' => 'is_deductible',
311 'type' => CRM_Utils_Type
::T_BOOLEAN
,
312 'title' => ts('Deductible Financial Account?'),
313 'description' => ts('Is this account tax-deductible?'),
314 'where' => 'civicrm_financial_account.is_deductible',
316 'table_name' => 'civicrm_financial_account',
317 'entity' => 'FinancialAccount',
318 'bao' => 'CRM_Financial_BAO_FinancialAccount',
324 'type' => CRM_Utils_Type
::T_BOOLEAN
,
325 'title' => ts('Tax Financial Account?'),
326 'description' => ts('Is this account for taxes?'),
327 'where' => 'civicrm_financial_account.is_tax',
329 'table_name' => 'civicrm_financial_account',
330 'entity' => 'FinancialAccount',
331 'bao' => 'CRM_Financial_BAO_FinancialAccount',
336 'name' => 'tax_rate',
337 'type' => CRM_Utils_Type
::T_MONEY
,
338 'title' => ts('Financial Account Tax Rate'),
339 'description' => ts('The percentage of the total_amount that is due for this tax.'),
344 'where' => 'civicrm_financial_account.tax_rate',
345 'table_name' => 'civicrm_financial_account',
346 'entity' => 'FinancialAccount',
347 'bao' => 'CRM_Financial_BAO_FinancialAccount',
352 'name' => 'is_reserved',
353 'type' => CRM_Utils_Type
::T_BOOLEAN
,
354 'title' => ts('Reserved Financial Account?'),
355 'description' => ts('Is this a predefined system object?'),
356 'where' => 'civicrm_financial_account.is_reserved',
357 'table_name' => 'civicrm_financial_account',
358 'entity' => 'FinancialAccount',
359 'bao' => 'CRM_Financial_BAO_FinancialAccount',
364 'name' => 'is_active',
365 'type' => CRM_Utils_Type
::T_BOOLEAN
,
366 'title' => ts('Financial Account is Active'),
367 'description' => ts('Is this property active?'),
368 'where' => 'civicrm_financial_account.is_active',
369 'table_name' => 'civicrm_financial_account',
370 'entity' => 'FinancialAccount',
371 'bao' => 'CRM_Financial_BAO_FinancialAccount',
376 'name' => 'is_default',
377 'type' => CRM_Utils_Type
::T_BOOLEAN
,
378 'title' => ts('Default Financial Account'),
379 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
380 'where' => 'civicrm_financial_account.is_default',
381 'table_name' => 'civicrm_financial_account',
382 'entity' => 'FinancialAccount',
383 'bao' => 'CRM_Financial_BAO_FinancialAccount',
388 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
390 return Civi
::$statics[__CLASS__
]['fields'];
394 * Return a mapping from field-name to the corresponding key (as used in fields()).
397 * Array(string $name => string $uniqueName).
399 public static function &fieldKeys() {
400 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
401 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
403 return Civi
::$statics[__CLASS__
]['fieldKeys'];
407 * Returns the names of this table
411 public static function getTableName() {
412 return self
::$_tableName;
416 * Returns if this table needs to be logged
420 public function getLog() {
425 * Returns the list of fields that can be imported
427 * @param bool $prefix
431 public static function &import($prefix = FALSE) {
432 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
437 * Returns the list of fields that can be exported
439 * @param bool $prefix
443 public static function &export($prefix = FALSE) {
444 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
449 * Returns the list of indices
451 * @param bool $localize
455 public static function indices($localize = TRUE) {
462 'localizable' => FALSE,
464 'sig' => 'civicrm_financial_account::1::name',
467 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;