5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Financial/FinancialAccount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4b1497d1607b10f8eec89c101665cd1d)
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 static $_tableName = 'civicrm_financial_account';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'ID',
174 'table_name' => 'civicrm_financial_account',
175 'entity' => 'FinancialAccount',
176 'bao' => 'CRM_Financial_BAO_FinancialAccount',
181 'type' => CRM_Utils_Type
::T_STRING
,
182 'title' => ts('Financial Account Name'),
183 'description' => 'Financial Account Name.',
186 'size' => CRM_Utils_Type
::HUGE
,
187 'table_name' => 'civicrm_financial_account',
188 'entity' => 'FinancialAccount',
189 'bao' => 'CRM_Financial_BAO_FinancialAccount',
192 'financial_account_contact_id' => [
193 'name' => 'contact_id',
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Contact ID'),
196 'description' => 'FK to Contact ID that is responsible for the funds in this account',
197 'table_name' => 'civicrm_financial_account',
198 'entity' => 'FinancialAccount',
199 'bao' => 'CRM_Financial_BAO_FinancialAccount',
201 'FKClassName' => 'CRM_Contact_DAO_Contact',
203 'financial_account_type_id' => [
204 'name' => 'financial_account_type_id',
205 'type' => CRM_Utils_Type
::T_INT
,
206 'title' => ts('Financial Account Type'),
207 'description' => 'pseudo FK into civicrm_option_value.',
210 'table_name' => 'civicrm_financial_account',
211 'entity' => 'FinancialAccount',
212 'bao' => 'CRM_Financial_BAO_FinancialAccount',
217 'pseudoconstant' => [
218 'optionGroupName' => 'financial_account_type',
219 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
222 'accounting_code' => [
223 'name' => 'accounting_code',
224 'type' => CRM_Utils_Type
::T_STRING
,
225 'title' => ts('Accounting Code'),
226 'description' => 'Optional value for mapping monies owed and received to accounting system codes.',
228 'size' => CRM_Utils_Type
::BIG
,
230 'where' => 'civicrm_financial_account.accounting_code',
231 'headerPattern' => '',
233 'table_name' => 'civicrm_financial_account',
234 'entity' => 'FinancialAccount',
235 'bao' => 'CRM_Financial_BAO_FinancialAccount',
238 'account_type_code' => [
239 'name' => 'account_type_code',
240 'type' => CRM_Utils_Type
::T_STRING
,
241 'title' => ts('Account Type Code'),
242 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).',
244 'size' => CRM_Utils_Type
::BIG
,
246 'where' => 'civicrm_financial_account.account_type_code',
247 'headerPattern' => '',
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' => 'Financial Type Description.',
260 'size' => CRM_Utils_Type
::HUGE
,
261 'table_name' => 'civicrm_financial_account',
262 'entity' => 'FinancialAccount',
263 'bao' => 'CRM_Financial_BAO_FinancialAccount',
267 'name' => 'parent_id',
268 'type' => CRM_Utils_Type
::T_INT
,
269 'title' => ts('Financial Account Parent'),
270 'description' => 'Parent ID in account hierarchy',
271 'table_name' => 'civicrm_financial_account',
272 'entity' => 'FinancialAccount',
273 'bao' => 'CRM_Financial_BAO_FinancialAccount',
275 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
277 'is_header_account' => [
278 'name' => 'is_header_account',
279 'type' => CRM_Utils_Type
::T_BOOLEAN
,
280 'title' => ts('Header Financial Account?'),
281 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
282 'table_name' => 'civicrm_financial_account',
283 'entity' => 'FinancialAccount',
284 'bao' => 'CRM_Financial_BAO_FinancialAccount',
288 'name' => 'is_deductible',
289 'type' => CRM_Utils_Type
::T_BOOLEAN
,
290 'title' => ts('Deductible Financial Account?'),
291 'description' => 'Is this account tax-deductible?',
293 'table_name' => 'civicrm_financial_account',
294 'entity' => 'FinancialAccount',
295 'bao' => 'CRM_Financial_BAO_FinancialAccount',
300 'type' => CRM_Utils_Type
::T_BOOLEAN
,
301 'title' => ts('Tax Financial Account?'),
302 'description' => 'Is this account for taxes?',
303 'table_name' => 'civicrm_financial_account',
304 'entity' => 'FinancialAccount',
305 'bao' => 'CRM_Financial_BAO_FinancialAccount',
309 'name' => 'tax_rate',
310 'type' => CRM_Utils_Type
::T_MONEY
,
311 'title' => ts('Financial Account Tax Rate'),
312 'description' => 'The percentage of the total_amount that is due for this tax.',
317 'table_name' => 'civicrm_financial_account',
318 'entity' => 'FinancialAccount',
319 'bao' => 'CRM_Financial_BAO_FinancialAccount',
323 'name' => 'is_reserved',
324 'type' => CRM_Utils_Type
::T_BOOLEAN
,
325 'title' => ts('Reserved Financial Account?'),
326 'description' => 'Is this a predefined system object?',
327 'table_name' => 'civicrm_financial_account',
328 'entity' => 'FinancialAccount',
329 'bao' => 'CRM_Financial_BAO_FinancialAccount',
333 'name' => 'is_active',
334 'type' => CRM_Utils_Type
::T_BOOLEAN
,
335 'title' => ts('Financial Account is Active'),
336 'description' => 'Is this property active?',
337 'table_name' => 'civicrm_financial_account',
338 'entity' => 'FinancialAccount',
339 'bao' => 'CRM_Financial_BAO_FinancialAccount',
343 'name' => 'is_default',
344 'type' => CRM_Utils_Type
::T_BOOLEAN
,
345 'title' => ts('Default Financial Account'),
346 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?',
347 'table_name' => 'civicrm_financial_account',
348 'entity' => 'FinancialAccount',
349 'bao' => 'CRM_Financial_BAO_FinancialAccount',
353 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
355 return Civi
::$statics[__CLASS__
]['fields'];
359 * Return a mapping from field-name to the corresponding key (as used in fields()).
362 * Array(string $name => string $uniqueName).
364 public static function &fieldKeys() {
365 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
366 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
368 return Civi
::$statics[__CLASS__
]['fieldKeys'];
372 * Returns the names of this table
376 public static function getTableName() {
377 return self
::$_tableName;
381 * Returns if this table needs to be logged
385 public function getLog() {
390 * Returns the list of fields that can be imported
392 * @param bool $prefix
396 public static function &import($prefix = FALSE) {
397 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
402 * Returns the list of fields that can be exported
404 * @param bool $prefix
408 public static function &export($prefix = FALSE) {
409 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
414 * Returns the list of indices
416 * @param bool $localize
420 public static function indices($localize = TRUE) {
427 'localizable' => FALSE,
429 'sig' => 'civicrm_financial_account::1::name',
432 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;