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:09d2e3d6a970fa2413b6f29ab1f580e0)
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 * @param bool $plural
150 * Whether to return the plural version of the title.
152 public static function getEntityTitle($plural = FALSE) {
153 return $plural ?
ts('Financial Accounts') : ts('Financial Account');
157 * Returns foreign keys and entity references.
160 * [CRM_Core_Reference_Interface]
162 public static function getReferenceColumns() {
163 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
164 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
165 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
166 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_financial_account', 'id');
167 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
169 return Civi
::$statics[__CLASS__
]['links'];
173 * Returns all the column names of this table
177 public static function &fields() {
178 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
179 Civi
::$statics[__CLASS__
]['fields'] = [
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Financial Account ID'),
184 'description' => ts('ID'),
186 'where' => 'civicrm_financial_account.id',
187 'table_name' => 'civicrm_financial_account',
188 'entity' => 'FinancialAccount',
189 'bao' => 'CRM_Financial_BAO_FinancialAccount',
195 'type' => CRM_Utils_Type
::T_STRING
,
196 'title' => ts('Financial Account Name'),
197 'description' => ts('Financial Account Name.'),
200 'size' => CRM_Utils_Type
::HUGE
,
201 'where' => 'civicrm_financial_account.name',
202 'table_name' => 'civicrm_financial_account',
203 'entity' => 'FinancialAccount',
204 'bao' => 'CRM_Financial_BAO_FinancialAccount',
208 'financial_account_contact_id' => [
209 'name' => 'contact_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Contact ID'),
212 'description' => ts('FK to Contact ID that is responsible for the funds in this account'),
213 'where' => 'civicrm_financial_account.contact_id',
214 'table_name' => 'civicrm_financial_account',
215 'entity' => 'FinancialAccount',
216 'bao' => 'CRM_Financial_BAO_FinancialAccount',
218 'FKClassName' => 'CRM_Contact_DAO_Contact',
221 'financial_account_type_id' => [
222 'name' => 'financial_account_type_id',
223 'type' => CRM_Utils_Type
::T_INT
,
224 'title' => ts('Financial Account Type'),
225 'description' => ts('pseudo FK into civicrm_option_value.'),
227 'where' => 'civicrm_financial_account.financial_account_type_id',
229 'table_name' => 'civicrm_financial_account',
230 'entity' => 'FinancialAccount',
231 'bao' => 'CRM_Financial_BAO_FinancialAccount',
236 'pseudoconstant' => [
237 'optionGroupName' => 'financial_account_type',
238 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
242 'accounting_code' => [
243 'name' => 'accounting_code',
244 'type' => CRM_Utils_Type
::T_STRING
,
245 'title' => ts('Accounting Code'),
246 'description' => ts('Optional value for mapping monies owed and received to accounting system codes.'),
248 'size' => CRM_Utils_Type
::BIG
,
249 'where' => 'civicrm_financial_account.accounting_code',
251 'table_name' => 'civicrm_financial_account',
252 'entity' => 'FinancialAccount',
253 'bao' => 'CRM_Financial_BAO_FinancialAccount',
257 'account_type_code' => [
258 'name' => 'account_type_code',
259 'type' => CRM_Utils_Type
::T_STRING
,
260 'title' => ts('Account Type Code'),
261 'description' => ts('Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).'),
263 'size' => CRM_Utils_Type
::BIG
,
264 'where' => 'civicrm_financial_account.account_type_code',
266 'table_name' => 'civicrm_financial_account',
267 'entity' => 'FinancialAccount',
268 'bao' => 'CRM_Financial_BAO_FinancialAccount',
273 'name' => 'description',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Financial Account Description'),
276 'description' => ts('Financial Type Description.'),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_financial_account.description',
280 'table_name' => 'civicrm_financial_account',
281 'entity' => 'FinancialAccount',
282 'bao' => 'CRM_Financial_BAO_FinancialAccount',
287 'name' => 'parent_id',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('Financial Account Parent'),
290 'description' => ts('Parent ID in account hierarchy'),
291 'where' => 'civicrm_financial_account.parent_id',
292 'table_name' => 'civicrm_financial_account',
293 'entity' => 'FinancialAccount',
294 'bao' => 'CRM_Financial_BAO_FinancialAccount',
296 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
299 'is_header_account' => [
300 'name' => 'is_header_account',
301 'type' => CRM_Utils_Type
::T_BOOLEAN
,
302 'title' => ts('Header Financial Account?'),
303 'description' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
304 'where' => 'civicrm_financial_account.is_header_account',
306 'table_name' => 'civicrm_financial_account',
307 'entity' => 'FinancialAccount',
308 'bao' => 'CRM_Financial_BAO_FinancialAccount',
313 'name' => 'is_deductible',
314 'type' => CRM_Utils_Type
::T_BOOLEAN
,
315 'title' => ts('Deductible Financial Account?'),
316 'description' => ts('Is this account tax-deductible?'),
317 'where' => 'civicrm_financial_account.is_deductible',
319 'table_name' => 'civicrm_financial_account',
320 'entity' => 'FinancialAccount',
321 'bao' => 'CRM_Financial_BAO_FinancialAccount',
327 'type' => CRM_Utils_Type
::T_BOOLEAN
,
328 'title' => ts('Tax Financial Account?'),
329 'description' => ts('Is this account for taxes?'),
330 'where' => 'civicrm_financial_account.is_tax',
332 'table_name' => 'civicrm_financial_account',
333 'entity' => 'FinancialAccount',
334 'bao' => 'CRM_Financial_BAO_FinancialAccount',
339 'name' => 'tax_rate',
340 'type' => CRM_Utils_Type
::T_MONEY
,
341 'title' => ts('Financial Account Tax Rate'),
342 'description' => ts('The percentage of the total_amount that is due for this tax.'),
347 'where' => 'civicrm_financial_account.tax_rate',
348 'table_name' => 'civicrm_financial_account',
349 'entity' => 'FinancialAccount',
350 'bao' => 'CRM_Financial_BAO_FinancialAccount',
355 'name' => 'is_reserved',
356 'type' => CRM_Utils_Type
::T_BOOLEAN
,
357 'title' => ts('Reserved Financial Account?'),
358 'description' => ts('Is this a predefined system object?'),
359 'where' => 'civicrm_financial_account.is_reserved',
360 'table_name' => 'civicrm_financial_account',
361 'entity' => 'FinancialAccount',
362 'bao' => 'CRM_Financial_BAO_FinancialAccount',
367 'name' => 'is_active',
368 'type' => CRM_Utils_Type
::T_BOOLEAN
,
369 'title' => ts('Financial Account is Active'),
370 'description' => ts('Is this property active?'),
371 'where' => 'civicrm_financial_account.is_active',
372 'table_name' => 'civicrm_financial_account',
373 'entity' => 'FinancialAccount',
374 'bao' => 'CRM_Financial_BAO_FinancialAccount',
379 'name' => 'is_default',
380 'type' => CRM_Utils_Type
::T_BOOLEAN
,
381 'title' => ts('Default Financial Account'),
382 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
383 'where' => 'civicrm_financial_account.is_default',
384 'table_name' => 'civicrm_financial_account',
385 'entity' => 'FinancialAccount',
386 'bao' => 'CRM_Financial_BAO_FinancialAccount',
391 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
393 return Civi
::$statics[__CLASS__
]['fields'];
397 * Return a mapping from field-name to the corresponding key (as used in fields()).
400 * Array(string $name => string $uniqueName).
402 public static function &fieldKeys() {
403 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
404 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
406 return Civi
::$statics[__CLASS__
]['fieldKeys'];
410 * Returns the names of this table
414 public static function getTableName() {
415 return self
::$_tableName;
419 * Returns if this table needs to be logged
423 public function getLog() {
428 * Returns the list of fields that can be imported
430 * @param bool $prefix
434 public static function &import($prefix = FALSE) {
435 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
440 * Returns the list of fields that can be exported
442 * @param bool $prefix
446 public static function &export($prefix = FALSE) {
447 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
452 * Returns the list of indices
454 * @param bool $localize
458 public static function indices($localize = TRUE) {
465 'localizable' => FALSE,
467 'sig' => 'civicrm_financial_account::1::name',
470 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;