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:0548d4cfb2f156e6a5ef42fbc7fe4d08)
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';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_financial_account';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * Financial Account Name.
49 * FK to Contact ID that is responsible for the funds in this account
56 * pseudo FK into civicrm_option_value.
60 public $financial_account_type_id;
63 * Optional value for mapping monies owed and received to accounting system codes.
67 public $accounting_code;
70 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
74 public $account_type_code;
77 * Financial Type Description.
84 * Parent ID in account hierarchy
91 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
95 public $is_header_account;
98 * Is this account tax-deductible?
102 public $is_deductible;
105 * Is this account for taxes?
112 * The percentage of the total_amount that is due for this tax.
119 * Is this a predefined system object?
126 * Is this property active?
133 * Is this account the default one (or default tax one) for its financial_account_type?
142 public function __construct() {
143 $this->__table
= 'civicrm_financial_account';
144 parent
::__construct();
148 * Returns localized title of this entity.
150 * @param bool $plural
151 * Whether to return the plural version of the title.
153 public static function getEntityTitle($plural = FALSE) {
154 return $plural ?
ts('Financial Accounts') : ts('Financial Account');
158 * Returns foreign keys and entity references.
161 * [CRM_Core_Reference_Interface]
163 public static function getReferenceColumns() {
164 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
165 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
166 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
167 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_financial_account', 'id');
168 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
170 return Civi
::$statics[__CLASS__
]['links'];
174 * Returns all the column names of this table
178 public static function &fields() {
179 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
180 Civi
::$statics[__CLASS__
]['fields'] = [
183 'type' => CRM_Utils_Type
::T_INT
,
184 'title' => ts('Financial Account ID'),
185 'description' => ts('ID'),
187 'where' => 'civicrm_financial_account.id',
188 'table_name' => 'civicrm_financial_account',
189 'entity' => 'FinancialAccount',
190 'bao' => 'CRM_Financial_BAO_FinancialAccount',
200 'type' => CRM_Utils_Type
::T_STRING
,
201 'title' => ts('Financial Account Name'),
202 'description' => ts('Financial Account Name.'),
205 'size' => CRM_Utils_Type
::HUGE
,
206 'where' => 'civicrm_financial_account.name',
207 'table_name' => 'civicrm_financial_account',
208 'entity' => 'FinancialAccount',
209 'bao' => 'CRM_Financial_BAO_FinancialAccount',
213 'financial_account_contact_id' => [
214 'name' => 'contact_id',
215 'type' => CRM_Utils_Type
::T_INT
,
216 'title' => ts('Contact ID'),
217 'description' => ts('FK to Contact ID that is responsible for the funds in this account'),
218 'where' => 'civicrm_financial_account.contact_id',
219 'table_name' => 'civicrm_financial_account',
220 'entity' => 'FinancialAccount',
221 'bao' => 'CRM_Financial_BAO_FinancialAccount',
223 'FKClassName' => 'CRM_Contact_DAO_Contact',
225 'label' => ts("Contact"),
229 'financial_account_type_id' => [
230 'name' => 'financial_account_type_id',
231 'type' => CRM_Utils_Type
::T_INT
,
232 'title' => ts('Financial Account Type'),
233 'description' => ts('pseudo FK into civicrm_option_value.'),
235 'where' => 'civicrm_financial_account.financial_account_type_id',
237 'table_name' => 'civicrm_financial_account',
238 'entity' => 'FinancialAccount',
239 'bao' => 'CRM_Financial_BAO_FinancialAccount',
244 'pseudoconstant' => [
245 'optionGroupName' => 'financial_account_type',
246 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
250 'accounting_code' => [
251 'name' => 'accounting_code',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Accounting Code'),
254 'description' => ts('Optional value for mapping monies owed and received to accounting system codes.'),
256 'size' => CRM_Utils_Type
::BIG
,
257 'where' => 'civicrm_financial_account.accounting_code',
259 'table_name' => 'civicrm_financial_account',
260 'entity' => 'FinancialAccount',
261 'bao' => 'CRM_Financial_BAO_FinancialAccount',
265 'account_type_code' => [
266 'name' => 'account_type_code',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Account Type Code'),
269 'description' => ts('Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).'),
271 'size' => CRM_Utils_Type
::BIG
,
272 'where' => 'civicrm_financial_account.account_type_code',
274 'table_name' => 'civicrm_financial_account',
275 'entity' => 'FinancialAccount',
276 'bao' => 'CRM_Financial_BAO_FinancialAccount',
281 'name' => 'description',
282 'type' => CRM_Utils_Type
::T_STRING
,
283 'title' => ts('Financial Account Description'),
284 'description' => ts('Financial Type Description.'),
286 'size' => CRM_Utils_Type
::HUGE
,
287 'where' => 'civicrm_financial_account.description',
288 'table_name' => 'civicrm_financial_account',
289 'entity' => 'FinancialAccount',
290 'bao' => 'CRM_Financial_BAO_FinancialAccount',
295 'name' => 'parent_id',
296 'type' => CRM_Utils_Type
::T_INT
,
297 'title' => ts('Parent ID'),
298 'description' => ts('Parent ID in account hierarchy'),
299 'where' => 'civicrm_financial_account.parent_id',
300 'table_name' => 'civicrm_financial_account',
301 'entity' => 'FinancialAccount',
302 'bao' => 'CRM_Financial_BAO_FinancialAccount',
304 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
306 'label' => ts("Parent"),
310 'is_header_account' => [
311 'name' => 'is_header_account',
312 'type' => CRM_Utils_Type
::T_BOOLEAN
,
313 'title' => ts('Header Financial Account?'),
314 'description' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
315 'where' => 'civicrm_financial_account.is_header_account',
317 'table_name' => 'civicrm_financial_account',
318 'entity' => 'FinancialAccount',
319 'bao' => 'CRM_Financial_BAO_FinancialAccount',
324 'name' => 'is_deductible',
325 'type' => CRM_Utils_Type
::T_BOOLEAN
,
326 'title' => ts('Deductible Financial Account?'),
327 'description' => ts('Is this account tax-deductible?'),
328 'where' => 'civicrm_financial_account.is_deductible',
330 'table_name' => 'civicrm_financial_account',
331 'entity' => 'FinancialAccount',
332 'bao' => 'CRM_Financial_BAO_FinancialAccount',
338 'type' => CRM_Utils_Type
::T_BOOLEAN
,
339 'title' => ts('Tax Financial Account?'),
340 'description' => ts('Is this account for taxes?'),
341 'where' => 'civicrm_financial_account.is_tax',
343 'table_name' => 'civicrm_financial_account',
344 'entity' => 'FinancialAccount',
345 'bao' => 'CRM_Financial_BAO_FinancialAccount',
350 'name' => 'tax_rate',
351 'type' => CRM_Utils_Type
::T_MONEY
,
352 'title' => ts('Financial Account Tax Rate'),
353 'description' => ts('The percentage of the total_amount that is due for this tax.'),
358 'where' => 'civicrm_financial_account.tax_rate',
359 'table_name' => 'civicrm_financial_account',
360 'entity' => 'FinancialAccount',
361 'bao' => 'CRM_Financial_BAO_FinancialAccount',
366 'name' => 'is_reserved',
367 'type' => CRM_Utils_Type
::T_BOOLEAN
,
368 'title' => ts('Reserved Financial Account?'),
369 'description' => ts('Is this a predefined system object?'),
370 'where' => 'civicrm_financial_account.is_reserved',
371 'table_name' => 'civicrm_financial_account',
372 'entity' => 'FinancialAccount',
373 'bao' => 'CRM_Financial_BAO_FinancialAccount',
378 'name' => 'is_active',
379 'type' => CRM_Utils_Type
::T_BOOLEAN
,
380 'title' => ts('Financial Account is Active'),
381 'description' => ts('Is this property active?'),
382 'where' => 'civicrm_financial_account.is_active',
383 'table_name' => 'civicrm_financial_account',
384 'entity' => 'FinancialAccount',
385 'bao' => 'CRM_Financial_BAO_FinancialAccount',
390 'name' => 'is_default',
391 'type' => CRM_Utils_Type
::T_BOOLEAN
,
392 'title' => ts('Default Financial Account'),
393 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
394 'where' => 'civicrm_financial_account.is_default',
395 'table_name' => 'civicrm_financial_account',
396 'entity' => 'FinancialAccount',
397 'bao' => 'CRM_Financial_BAO_FinancialAccount',
402 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
404 return Civi
::$statics[__CLASS__
]['fields'];
408 * Return a mapping from field-name to the corresponding key (as used in fields()).
411 * Array(string $name => string $uniqueName).
413 public static function &fieldKeys() {
414 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
415 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
417 return Civi
::$statics[__CLASS__
]['fieldKeys'];
421 * Returns the names of this table
425 public static function getTableName() {
426 return self
::$_tableName;
430 * Returns if this table needs to be logged
434 public function getLog() {
439 * Returns the list of fields that can be imported
441 * @param bool $prefix
445 public static function &import($prefix = FALSE) {
446 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
451 * Returns the list of fields that can be exported
453 * @param bool $prefix
457 public static function &export($prefix = FALSE) {
458 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
463 * Returns the list of indices
465 * @param bool $localize
469 public static function indices($localize = TRUE) {
476 'localizable' => FALSE,
478 'sig' => 'civicrm_financial_account::1::name',
481 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;