3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Financial/FinancialAccount.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:14d3715c48b20555e6bce4ff679cd251)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Financial_DAO_FinancialAccount constructor.
40 class CRM_Financial_DAO_FinancialAccount
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_financial_account';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * Financial Account Name.
66 * FK to Contact ID that is responsible for the funds in this account
72 * pseudo FK into civicrm_option_value.
76 public $financial_account_type_id;
78 * Optional value for mapping monies owed and received to accounting system codes.
82 public $accounting_code;
84 * Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).
88 public $account_type_code;
90 * Financial Type Description.
96 * Parent ID in account hierarchy
102 * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
106 public $is_header_account;
108 * Is this account tax-deductible?
112 public $is_deductible;
114 * Is this account for taxes?
120 * The percentage of the total_amount that is due for this tax.
126 * Is this a predefined system object?
132 * Is this property active?
138 * Is this account the default one (or default tax one) for its financial_account_type?
146 function __construct() {
147 $this->__table
= 'civicrm_financial_account';
148 parent
::__construct();
151 * Returns foreign keys and entity references.
154 * [CRM_Core_Reference_Interface]
156 static function getReferenceColumns() {
157 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
158 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
160 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'parent_id', 'civicrm_financial_account', 'id');
161 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
163 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = array(
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Financial Account ID') ,
177 'description' => 'ID',
179 'table_name' => 'civicrm_financial_account',
180 'entity' => 'FinancialAccount',
181 'bao' => 'CRM_Financial_BAO_FinancialAccount',
185 'type' => CRM_Utils_Type
::T_STRING
,
186 'title' => ts('Financial Account Name') ,
187 'description' => 'Financial Account Name.',
190 'size' => CRM_Utils_Type
::HUGE
,
191 'table_name' => 'civicrm_financial_account',
192 'entity' => 'FinancialAccount',
193 'bao' => 'CRM_Financial_BAO_FinancialAccount',
195 'financial_account_contact_id' => array(
196 'name' => 'contact_id',
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Contact ID') ,
199 'description' => 'FK to Contact ID that is responsible for the funds in this account',
200 'table_name' => 'civicrm_financial_account',
201 'entity' => 'FinancialAccount',
202 'bao' => 'CRM_Financial_BAO_FinancialAccount',
203 'FKClassName' => 'CRM_Contact_DAO_Contact',
205 'financial_account_type_id' => array(
206 'name' => 'financial_account_type_id',
207 'type' => CRM_Utils_Type
::T_INT
,
208 'title' => ts('Financial Account Type') ,
209 'description' => 'pseudo FK into civicrm_option_value.',
212 'table_name' => 'civicrm_financial_account',
213 'entity' => 'FinancialAccount',
214 'bao' => 'CRM_Financial_BAO_FinancialAccount',
218 'pseudoconstant' => array(
219 'optionGroupName' => 'financial_account_type',
220 'optionEditPath' => 'civicrm/admin/options/financial_account_type',
223 'accounting_code' => array(
224 'name' => 'accounting_code',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Accounting Code') ,
227 'description' => 'Optional value for mapping monies owed and received to accounting system codes.',
229 'size' => CRM_Utils_Type
::BIG
,
231 'where' => 'civicrm_financial_account.accounting_code',
232 'headerPattern' => '',
234 'table_name' => 'civicrm_financial_account',
235 'entity' => 'FinancialAccount',
236 'bao' => 'CRM_Financial_BAO_FinancialAccount',
238 'account_type_code' => array(
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',
253 'description' => array(
254 'name' => 'description',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Financial Account Description') ,
257 'description' => 'Financial Type Description.',
259 'size' => CRM_Utils_Type
::HUGE
,
260 'table_name' => 'civicrm_financial_account',
261 'entity' => 'FinancialAccount',
262 'bao' => 'CRM_Financial_BAO_FinancialAccount',
264 'parent_id' => array(
265 'name' => 'parent_id',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('Financial Account Parent') ,
268 'description' => 'Parent ID in account hierarchy',
269 'table_name' => 'civicrm_financial_account',
270 'entity' => 'FinancialAccount',
271 'bao' => 'CRM_Financial_BAO_FinancialAccount',
272 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
274 'is_header_account' => array(
275 'name' => 'is_header_account',
276 'type' => CRM_Utils_Type
::T_BOOLEAN
,
277 'title' => ts('Header Financial Account?') ,
278 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
279 'table_name' => 'civicrm_financial_account',
280 'entity' => 'FinancialAccount',
281 'bao' => 'CRM_Financial_BAO_FinancialAccount',
283 'is_deductible' => array(
284 'name' => 'is_deductible',
285 'type' => CRM_Utils_Type
::T_BOOLEAN
,
286 'title' => ts('Deductible Financial Account?') ,
287 'description' => 'Is this account tax-deductible?',
289 'table_name' => 'civicrm_financial_account',
290 'entity' => 'FinancialAccount',
291 'bao' => 'CRM_Financial_BAO_FinancialAccount',
295 'type' => CRM_Utils_Type
::T_BOOLEAN
,
296 'title' => ts('Tax Financial Account?') ,
297 'description' => 'Is this account for taxes?',
298 'table_name' => 'civicrm_financial_account',
299 'entity' => 'FinancialAccount',
300 'bao' => 'CRM_Financial_BAO_FinancialAccount',
303 'name' => 'tax_rate',
304 'type' => CRM_Utils_Type
::T_MONEY
,
305 'title' => ts('Financial Account Tax Rate') ,
306 'description' => 'The percentage of the total_amount that is due for this tax.',
307 'precision' => array(
311 'table_name' => 'civicrm_financial_account',
312 'entity' => 'FinancialAccount',
313 'bao' => 'CRM_Financial_BAO_FinancialAccount',
315 'is_reserved' => array(
316 'name' => 'is_reserved',
317 'type' => CRM_Utils_Type
::T_BOOLEAN
,
318 'title' => ts('Reserved Financial Account?') ,
319 'description' => 'Is this a predefined system object?',
320 'table_name' => 'civicrm_financial_account',
321 'entity' => 'FinancialAccount',
322 'bao' => 'CRM_Financial_BAO_FinancialAccount',
324 'is_active' => array(
325 'name' => 'is_active',
326 'type' => CRM_Utils_Type
::T_BOOLEAN
,
327 'title' => ts('Financial Account is Active') ,
328 'description' => 'Is this property active?',
329 'table_name' => 'civicrm_financial_account',
330 'entity' => 'FinancialAccount',
331 'bao' => 'CRM_Financial_BAO_FinancialAccount',
333 'is_default' => array(
334 'name' => 'is_default',
335 'type' => CRM_Utils_Type
::T_BOOLEAN
,
336 'title' => ts('Default Financial Account') ,
337 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?',
338 'table_name' => 'civicrm_financial_account',
339 'entity' => 'FinancialAccount',
340 'bao' => 'CRM_Financial_BAO_FinancialAccount',
343 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
345 return Civi
::$statics[__CLASS__
]['fields'];
348 * Return a mapping from field-name to the corresponding key (as used in fields()).
351 * Array(string $name => string $uniqueName).
353 static function &fieldKeys() {
354 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
355 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
357 return Civi
::$statics[__CLASS__
]['fieldKeys'];
360 * Returns the names of this table
364 static function getTableName() {
365 return self
::$_tableName;
368 * Returns if this table needs to be logged
376 * Returns the list of fields that can be imported
378 * @param bool $prefix
382 static function &import($prefix = false) {
383 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_account', $prefix, array());
387 * Returns the list of fields that can be exported
389 * @param bool $prefix
393 static function &export($prefix = false) {
394 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_account', $prefix, array());