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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'),
283 'table_name' => 'civicrm_financial_account',
284 'entity' => 'FinancialAccount',
285 'bao' => 'CRM_Financial_BAO_FinancialAccount',
289 'name' => 'is_deductible',
290 'type' => CRM_Utils_Type
::T_BOOLEAN
,
291 'title' => ts('Deductible Financial Account?'),
292 'description' => ts('Is this account tax-deductible?'),
294 'table_name' => 'civicrm_financial_account',
295 'entity' => 'FinancialAccount',
296 'bao' => 'CRM_Financial_BAO_FinancialAccount',
301 'type' => CRM_Utils_Type
::T_BOOLEAN
,
302 'title' => ts('Tax Financial Account?'),
303 'description' => ts('Is this account for taxes?'),
305 'table_name' => 'civicrm_financial_account',
306 'entity' => 'FinancialAccount',
307 'bao' => 'CRM_Financial_BAO_FinancialAccount',
311 'name' => 'tax_rate',
312 'type' => CRM_Utils_Type
::T_MONEY
,
313 'title' => ts('Financial Account Tax Rate'),
314 'description' => ts('The percentage of the total_amount that is due for this tax.'),
319 'table_name' => 'civicrm_financial_account',
320 'entity' => 'FinancialAccount',
321 'bao' => 'CRM_Financial_BAO_FinancialAccount',
325 'name' => 'is_reserved',
326 'type' => CRM_Utils_Type
::T_BOOLEAN
,
327 'title' => ts('Reserved Financial Account?'),
328 'description' => ts('Is this a predefined system object?'),
329 'table_name' => 'civicrm_financial_account',
330 'entity' => 'FinancialAccount',
331 'bao' => 'CRM_Financial_BAO_FinancialAccount',
335 'name' => 'is_active',
336 'type' => CRM_Utils_Type
::T_BOOLEAN
,
337 'title' => ts('Financial Account is Active'),
338 'description' => ts('Is this property active?'),
339 'table_name' => 'civicrm_financial_account',
340 'entity' => 'FinancialAccount',
341 'bao' => 'CRM_Financial_BAO_FinancialAccount',
345 'name' => 'is_default',
346 'type' => CRM_Utils_Type
::T_BOOLEAN
,
347 'title' => ts('Default Financial Account'),
348 'description' => ts('Is this account the default one (or default tax one) for its financial_account_type?'),
349 'table_name' => 'civicrm_financial_account',
350 'entity' => 'FinancialAccount',
351 'bao' => 'CRM_Financial_BAO_FinancialAccount',
355 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
357 return Civi
::$statics[__CLASS__
]['fields'];
361 * Return a mapping from field-name to the corresponding key (as used in fields()).
364 * Array(string $name => string $uniqueName).
366 public static function &fieldKeys() {
367 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
368 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
370 return Civi
::$statics[__CLASS__
]['fieldKeys'];
374 * Returns the names of this table
378 public static function getTableName() {
379 return self
::$_tableName;
383 * Returns if this table needs to be logged
387 public function getLog() {
392 * Returns the list of fields that can be imported
394 * @param bool $prefix
398 public static function &import($prefix = FALSE) {
399 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, []);
404 * Returns the list of fields that can be exported
406 * @param bool $prefix
410 public static function &export($prefix = FALSE) {
411 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, []);
416 * Returns the list of indices
418 * @param bool $localize
422 public static function indices($localize = TRUE) {
429 'localizable' => FALSE,
431 'sig' => 'civicrm_financial_account::1::name',
434 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;