3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
31 * Generated from xml/schema/CRM/Financial/FinancialItem.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:576910be69f2500aa8b4f37cc6b823ad)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Financial_DAO_FinancialItem
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_financial_item';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
89 * Date and time the item was created
95 * Date and time of the source transaction
99 public $transaction_date;
101 * FK to Contact ID of contact the item is from
107 * Human readable description of this item, to ease display without lookup of source item.
113 * Total amount of this item
119 * Currency for the amount
125 * FK to civicrm_financial_account
129 public $financial_account_id;
131 * Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)
137 * The table providing the source of this item such as civicrm_line_item
141 public $entity_table;
143 * The specific source item that is responsible for the creation of this financial_item
151 * @return civicrm_financial_item
153 function __construct() {
154 $this->__table
= 'civicrm_financial_item';
155 parent
::__construct();
158 * Returns foreign keys and entity references
161 * [CRM_Core_Reference_Interface]
163 static function getReferenceColumns() {
164 if (!self
::$_links) {
165 self
::$_links = static ::createReferenceColumns(__CLASS__
);
166 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
167 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id');
168 self
::$_links[] = new CRM_Core_Reference_Dynamic(self
::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
170 return self
::$_links;
173 * Returns all the column names of this table
177 static function &fields() {
178 if (!(self
::$_fields)) {
179 self
::$_fields = array(
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Financial Item ID') ,
186 'created_date' => array(
187 'name' => 'created_date',
188 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
189 'title' => ts('Financial Item Created Date') ,
190 'description' => 'Date and time the item was created',
192 'default' => 'CURRENT_TIMESTAMP',
194 'transaction_date' => array(
195 'name' => 'transaction_date',
196 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
197 'title' => ts('Financial Item Transaction Date') ,
198 'description' => 'Date and time of the source transaction',
201 'contact_id' => array(
202 'name' => 'contact_id',
203 'type' => CRM_Utils_Type
::T_INT
,
204 'title' => ts('Financial Item Contact ID') ,
205 'description' => 'FK to Contact ID of contact the item is from',
208 'where' => 'civicrm_financial_item.contact_id',
209 'headerPattern' => '',
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
213 'description' => array(
214 'name' => 'description',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Financial Item Description') ,
217 'description' => 'Human readable description of this item, to ease display without lookup of source item.',
219 'size' => CRM_Utils_Type
::HUGE
,
223 'type' => CRM_Utils_Type
::T_MONEY
,
224 'title' => ts('Amount') ,
225 'description' => 'Total amount of this item',
227 'precision' => array(
233 'name' => 'currency',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Financial Item Currency') ,
236 'description' => 'Currency for the amount',
238 'size' => CRM_Utils_Type
::FOUR
,
240 'where' => 'civicrm_financial_item.currency',
241 'headerPattern' => '',
246 'pseudoconstant' => array(
247 'table' => 'civicrm_currency',
248 'keyColumn' => 'name',
249 'labelColumn' => 'full_name',
250 'nameColumn' => 'name',
253 'financial_account_id' => array(
254 'name' => 'financial_account_id',
255 'type' => CRM_Utils_Type
::T_INT
,
256 'title' => ts('Financial Account ID') ,
257 'description' => 'FK to civicrm_financial_account',
258 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
262 'pseudoconstant' => array(
263 'table' => 'civicrm_financial_account',
265 'labelColumn' => 'name',
268 'status_id' => array(
269 'name' => 'status_id',
270 'type' => CRM_Utils_Type
::T_INT
,
271 'title' => ts('Financial Item Status ID') ,
272 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)',
274 'where' => 'civicrm_financial_item.status_id',
275 'headerPattern' => '',
280 'pseudoconstant' => array(
281 'optionGroupName' => 'financial_item_status',
282 'optionEditPath' => 'civicrm/admin/options/financial_item_status',
285 'entity_table' => array(
286 'name' => 'entity_table',
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('Entity Table') ,
289 'description' => 'The table providing the source of this item such as civicrm_line_item',
291 'size' => CRM_Utils_Type
::BIG
,
293 'entity_id' => array(
294 'name' => 'entity_id',
295 'type' => CRM_Utils_Type
::T_INT
,
296 'title' => ts('Entity ID') ,
297 'description' => 'The specific source item that is responsible for the creation of this financial_item',
301 return self
::$_fields;
304 * Returns an array containing, for each field, the arary key used for that
305 * field in self::$_fields.
309 static function &fieldKeys() {
310 if (!(self
::$_fieldKeys)) {
311 self
::$_fieldKeys = array(
313 'created_date' => 'created_date',
314 'transaction_date' => 'transaction_date',
315 'contact_id' => 'contact_id',
316 'description' => 'description',
317 'amount' => 'amount',
318 'currency' => 'currency',
319 'financial_account_id' => 'financial_account_id',
320 'status_id' => 'status_id',
321 'entity_table' => 'entity_table',
322 'entity_id' => 'entity_id',
325 return self
::$_fieldKeys;
328 * Returns the names of this table
332 static function getTableName() {
333 return self
::$_tableName;
336 * Returns if this table needs to be logged
344 * Returns the list of fields that can be imported
346 * @param bool $prefix
350 static function &import($prefix = false) {
351 if (!(self
::$_import)) {
352 self
::$_import = array();
353 $fields = self
::fields();
354 foreach($fields as $name => $field) {
355 if (CRM_Utils_Array
::value('import', $field)) {
357 self
::$_import['financial_item'] = & $fields[$name];
359 self
::$_import[$name] = & $fields[$name];
364 return self
::$_import;
367 * Returns the list of fields that can be exported
369 * @param bool $prefix
373 static function &export($prefix = false) {
374 if (!(self
::$_export)) {
375 self
::$_export = array();
376 $fields = self
::fields();
377 foreach($fields as $name => $field) {
378 if (CRM_Utils_Array
::value('export', $field)) {
380 self
::$_export['financial_item'] = & $fields[$name];
382 self
::$_export[$name] = & $fields[$name];
387 return self
::$_export;