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:ccca91d77f1c8f2639bf0d81bd484b9c)
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 foreign keys and entity references.
148 * [CRM_Core_Reference_Interface]
150 public static function getReferenceColumns() {
151 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
152 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
153 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
154 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_financial_account', 'id');
155 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
157 return Civi
::$statics[__CLASS__
]['links'];
161 * Returns all the column names of this table
165 public static function &fields() {
166 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
167 Civi
::$statics[__CLASS__
]['fields'] = [
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Financial Account ID'),
172 'description' => ts('ID'),
174 'where' => 'civicrm_financial_account.id',
175 'table_name' => 'civicrm_financial_account',
176 'entity' => 'FinancialAccount',
177 'bao' => 'CRM_Financial_BAO_FinancialAccount',
182 'type' => CRM_Utils_Type
::T_STRING
,
183 'title' => ts('Financial Account Name'),
184 'description' => ts('Financial Account Name.'),
187 'size' => CRM_Utils_Type
::HUGE
,
188 'where' => 'civicrm_financial_account.name',
189 'table_name' => 'civicrm_financial_account',
190 'entity' => 'FinancialAccount',
191 'bao' => 'CRM_Financial_BAO_FinancialAccount',
194 'financial_account_contact_id' => [
195 'name' => 'contact_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Contact ID'),
198 'description' => ts('FK to Contact ID that is responsible for the funds in this account'),
199 'where' => 'civicrm_financial_account.contact_id',
200 'table_name' => 'civicrm_financial_account',
201 'entity' => 'FinancialAccount',
202 'bao' => 'CRM_Financial_BAO_FinancialAccount',
204 'FKClassName' => 'CRM_Contact_DAO_Contact',
206 'financial_account_type_id' => [
207 'name' => 'financial_account_type_id',
208 'type' => CRM_Utils_Type
::T_INT
,
209 'title' => ts('Financial Account Type'),
210 'description' => ts('pseudo FK into civicrm_option_value.'),
212 'where' => 'civicrm_financial_account.financial_account_type_id',
214 'table_name' => 'civicrm_financial_account',
215 'entity' => 'FinancialAccount',
216 'bao' => 'CRM_Financial_BAO_FinancialAccount',
221 'pseudoconstant' => [
222 'optionGroupName' => 'financial_account_type',
223 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
226 'accounting_code' => [
227 'name' => 'accounting_code',
228 'type' => CRM_Utils_Type
::T_STRING
,
229 'title' => ts('Accounting Code'),
230 'description' => ts('Optional value for mapping monies owed and received to accounting system codes.'),
232 'size' => CRM_Utils_Type
::BIG
,
233 'where' => 'civicrm_financial_account.accounting_code',
235 'table_name' => 'civicrm_financial_account',
236 'entity' => 'FinancialAccount',
237 'bao' => 'CRM_Financial_BAO_FinancialAccount',
240 'account_type_code' => [
241 'name' => 'account_type_code',
242 'type' => CRM_Utils_Type
::T_STRING
,
243 'title' => ts('Account Type Code'),
244 'description' => ts('Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).'),
246 'size' => CRM_Utils_Type
::BIG
,
247 'where' => 'civicrm_financial_account.account_type_code',
249 'table_name' => 'civicrm_financial_account',
250 'entity' => 'FinancialAccount',
251 'bao' => 'CRM_Financial_BAO_FinancialAccount',
255 'name' => 'description',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Financial Account Description'),
258 'description' => ts('Financial Type Description.'),
260 'size' => CRM_Utils_Type
::HUGE
,
261 'where' => 'civicrm_financial_account.description',
262 'table_name' => 'civicrm_financial_account',
263 'entity' => 'FinancialAccount',
264 'bao' => 'CRM_Financial_BAO_FinancialAccount',
268 'name' => 'parent_id',
269 'type' => CRM_Utils_Type
::T_INT
,
270 'title' => ts('Financial Account Parent'),
271 'description' => ts('Parent ID in account hierarchy'),
272 'where' => 'civicrm_financial_account.parent_id',
273 'table_name' => 'civicrm_financial_account',
274 'entity' => 'FinancialAccount',
275 'bao' => 'CRM_Financial_BAO_FinancialAccount',
277 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
279 'is_header_account' => [
280 'name' => 'is_header_account',
281 'type' => CRM_Utils_Type
::T_BOOLEAN
,
282 'title' => ts('Header Financial Account?'),
283 'description' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
284 'where' => 'civicrm_financial_account.is_header_account',
286 'table_name' => 'civicrm_financial_account',
287 'entity' => 'FinancialAccount',
288 'bao' => 'CRM_Financial_BAO_FinancialAccount',
292 'name' => 'is_deductible',
293 'type' => CRM_Utils_Type
::T_BOOLEAN
,
294 'title' => ts('Deductible Financial Account?'),
295 'description' => ts('Is this account tax-deductible?'),
296 'where' => 'civicrm_financial_account.is_deductible',
298 'table_name' => 'civicrm_financial_account',
299 'entity' => 'FinancialAccount',
300 'bao' => 'CRM_Financial_BAO_FinancialAccount',
305 'type' => CRM_Utils_Type
::T_BOOLEAN
,
306 'title' => ts('Tax Financial Account?'),
307 'description' => ts('Is this account for taxes?'),
308 'where' => 'civicrm_financial_account.is_tax',
310 'table_name' => 'civicrm_financial_account',
311 'entity' => 'FinancialAccount',
312 'bao' => 'CRM_Financial_BAO_FinancialAccount',
316 'name' => 'tax_rate',
317 'type' => CRM_Utils_Type
::T_MONEY
,
318 'title' => ts('Financial Account Tax Rate'),
319 'description' => ts('The percentage of the total_amount that is due for this tax.'),
324 'where' => 'civicrm_financial_account.tax_rate',
325 'table_name' => 'civicrm_financial_account',
326 'entity' => 'FinancialAccount',
327 'bao' => 'CRM_Financial_BAO_FinancialAccount',
331 'name' => 'is_reserved',
332 'type' => CRM_Utils_Type
::T_BOOLEAN
,
333 'title' => ts('Reserved Financial Account?'),
334 'description' => ts('Is this a predefined system object?'),
335 'where' => 'civicrm_financial_account.is_reserved',
336 'table_name' => 'civicrm_financial_account',
337 'entity' => 'FinancialAccount',
338 'bao' => 'CRM_Financial_BAO_FinancialAccount',
342 'name' => 'is_active',
343 'type' => CRM_Utils_Type
::T_BOOLEAN
,
344 'title' => ts('Financial Account is Active'),
345 'description' => ts('Is this property active?'),
346 'where' => 'civicrm_financial_account.is_active',
347 'table_name' => 'civicrm_financial_account',
348 'entity' => 'FinancialAccount',
349 'bao' => 'CRM_Financial_BAO_FinancialAccount',
353 'name' => 'is_default',
354 'type' => CRM_Utils_Type
::T_BOOLEAN
,
355 'title' => ts('Default Financial Account'),
356 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
357 'where' => 'civicrm_financial_account.is_default',
358 'table_name' => 'civicrm_financial_account',
359 'entity' => 'FinancialAccount',
360 'bao' => 'CRM_Financial_BAO_FinancialAccount',
364 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
366 return Civi
::$statics[__CLASS__
]['fields'];
370 * Return a mapping from field-name to the corresponding key (as used in fields()).
373 * Array(string $name => string $uniqueName).
375 public static function &fieldKeys() {
376 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
377 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
379 return Civi
::$statics[__CLASS__
]['fieldKeys'];
383 * Returns the names of this table
387 public static function getTableName() {
388 return self
::$_tableName;
392 * Returns if this table needs to be logged
396 public function getLog() {
401 * Returns the list of fields that can be imported
403 * @param bool $prefix
407 public static function &import($prefix = FALSE) {
408 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
413 * Returns the list of fields that can be exported
415 * @param bool $prefix
419 public static function &export($prefix = FALSE) {
420 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
425 * Returns the list of indices
427 * @param bool $localize
431 public static function indices($localize = TRUE) {
438 'localizable' => FALSE,
440 'sig' => 'civicrm_financial_account::1::name',
443 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;