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:50acc3ed98cf98d333d2fa80d7089577)
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',
189 'type' => CRM_Utils_Type
::T_STRING
,
190 'title' => ts('Financial Account Name'),
191 'description' => ts('Financial Account Name.'),
194 'size' => CRM_Utils_Type
::HUGE
,
195 'where' => 'civicrm_financial_account.name',
196 'table_name' => 'civicrm_financial_account',
197 'entity' => 'FinancialAccount',
198 'bao' => 'CRM_Financial_BAO_FinancialAccount',
201 'financial_account_contact_id' => [
202 'name' => 'contact_id',
203 'type' => CRM_Utils_Type
::T_INT
,
204 'title' => ts('Contact ID'),
205 'description' => ts('FK to Contact ID that is responsible for the funds in this account'),
206 'where' => 'civicrm_financial_account.contact_id',
207 'table_name' => 'civicrm_financial_account',
208 'entity' => 'FinancialAccount',
209 'bao' => 'CRM_Financial_BAO_FinancialAccount',
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
213 'financial_account_type_id' => [
214 'name' => 'financial_account_type_id',
215 'type' => CRM_Utils_Type
::T_INT
,
216 'title' => ts('Financial Account Type'),
217 'description' => ts('pseudo FK into civicrm_option_value.'),
219 'where' => 'civicrm_financial_account.financial_account_type_id',
221 'table_name' => 'civicrm_financial_account',
222 'entity' => 'FinancialAccount',
223 'bao' => 'CRM_Financial_BAO_FinancialAccount',
228 'pseudoconstant' => [
229 'optionGroupName' => 'financial_account_type',
230 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
233 'accounting_code' => [
234 'name' => 'accounting_code',
235 'type' => CRM_Utils_Type
::T_STRING
,
236 'title' => ts('Accounting Code'),
237 'description' => ts('Optional value for mapping monies owed and received to accounting system codes.'),
239 'size' => CRM_Utils_Type
::BIG
,
240 'where' => 'civicrm_financial_account.accounting_code',
242 'table_name' => 'civicrm_financial_account',
243 'entity' => 'FinancialAccount',
244 'bao' => 'CRM_Financial_BAO_FinancialAccount',
247 'account_type_code' => [
248 'name' => 'account_type_code',
249 'type' => CRM_Utils_Type
::T_STRING
,
250 'title' => ts('Account Type Code'),
251 'description' => ts('Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).'),
253 'size' => CRM_Utils_Type
::BIG
,
254 'where' => 'civicrm_financial_account.account_type_code',
256 'table_name' => 'civicrm_financial_account',
257 'entity' => 'FinancialAccount',
258 'bao' => 'CRM_Financial_BAO_FinancialAccount',
262 'name' => 'description',
263 'type' => CRM_Utils_Type
::T_STRING
,
264 'title' => ts('Financial Account Description'),
265 'description' => ts('Financial Type Description.'),
267 'size' => CRM_Utils_Type
::HUGE
,
268 'where' => 'civicrm_financial_account.description',
269 'table_name' => 'civicrm_financial_account',
270 'entity' => 'FinancialAccount',
271 'bao' => 'CRM_Financial_BAO_FinancialAccount',
275 'name' => 'parent_id',
276 'type' => CRM_Utils_Type
::T_INT
,
277 'title' => ts('Financial Account Parent'),
278 'description' => ts('Parent ID in account hierarchy'),
279 'where' => 'civicrm_financial_account.parent_id',
280 'table_name' => 'civicrm_financial_account',
281 'entity' => 'FinancialAccount',
282 'bao' => 'CRM_Financial_BAO_FinancialAccount',
284 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
286 'is_header_account' => [
287 'name' => 'is_header_account',
288 'type' => CRM_Utils_Type
::T_BOOLEAN
,
289 'title' => ts('Header Financial Account?'),
290 'description' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
291 'where' => 'civicrm_financial_account.is_header_account',
293 'table_name' => 'civicrm_financial_account',
294 'entity' => 'FinancialAccount',
295 'bao' => 'CRM_Financial_BAO_FinancialAccount',
299 'name' => 'is_deductible',
300 'type' => CRM_Utils_Type
::T_BOOLEAN
,
301 'title' => ts('Deductible Financial Account?'),
302 'description' => ts('Is this account tax-deductible?'),
303 'where' => 'civicrm_financial_account.is_deductible',
305 'table_name' => 'civicrm_financial_account',
306 'entity' => 'FinancialAccount',
307 'bao' => 'CRM_Financial_BAO_FinancialAccount',
312 'type' => CRM_Utils_Type
::T_BOOLEAN
,
313 'title' => ts('Tax Financial Account?'),
314 'description' => ts('Is this account for taxes?'),
315 'where' => 'civicrm_financial_account.is_tax',
317 'table_name' => 'civicrm_financial_account',
318 'entity' => 'FinancialAccount',
319 'bao' => 'CRM_Financial_BAO_FinancialAccount',
323 'name' => 'tax_rate',
324 'type' => CRM_Utils_Type
::T_MONEY
,
325 'title' => ts('Financial Account Tax Rate'),
326 'description' => ts('The percentage of the total_amount that is due for this tax.'),
331 'where' => 'civicrm_financial_account.tax_rate',
332 'table_name' => 'civicrm_financial_account',
333 'entity' => 'FinancialAccount',
334 'bao' => 'CRM_Financial_BAO_FinancialAccount',
338 'name' => 'is_reserved',
339 'type' => CRM_Utils_Type
::T_BOOLEAN
,
340 'title' => ts('Reserved Financial Account?'),
341 'description' => ts('Is this a predefined system object?'),
342 'where' => 'civicrm_financial_account.is_reserved',
343 'table_name' => 'civicrm_financial_account',
344 'entity' => 'FinancialAccount',
345 'bao' => 'CRM_Financial_BAO_FinancialAccount',
349 'name' => 'is_active',
350 'type' => CRM_Utils_Type
::T_BOOLEAN
,
351 'title' => ts('Financial Account is Active'),
352 'description' => ts('Is this property active?'),
353 'where' => 'civicrm_financial_account.is_active',
354 'table_name' => 'civicrm_financial_account',
355 'entity' => 'FinancialAccount',
356 'bao' => 'CRM_Financial_BAO_FinancialAccount',
360 'name' => 'is_default',
361 'type' => CRM_Utils_Type
::T_BOOLEAN
,
362 'title' => ts('Default Financial Account'),
363 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
364 'where' => 'civicrm_financial_account.is_default',
365 'table_name' => 'civicrm_financial_account',
366 'entity' => 'FinancialAccount',
367 'bao' => 'CRM_Financial_BAO_FinancialAccount',
371 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
373 return Civi
::$statics[__CLASS__
]['fields'];
377 * Return a mapping from field-name to the corresponding key (as used in fields()).
380 * Array(string $name => string $uniqueName).
382 public static function &fieldKeys() {
383 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
384 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
386 return Civi
::$statics[__CLASS__
]['fieldKeys'];
390 * Returns the names of this table
394 public static function getTableName() {
395 return self
::$_tableName;
399 * Returns if this table needs to be logged
403 public function getLog() {
408 * Returns the list of fields that can be imported
410 * @param bool $prefix
414 public static function &import($prefix = FALSE) {
415 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
420 * Returns the list of fields that can be exported
422 * @param bool $prefix
426 public static function &export($prefix = FALSE) {
427 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
432 * Returns the list of indices
434 * @param bool $localize
438 public static function indices($localize = TRUE) {
445 'localizable' => FALSE,
447 'sig' => 'civicrm_financial_account::1::name',
450 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;