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:4abc5641f9aab2a8d925cf5898a3a858)
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 value to see if we should log any modifications to
46 * this table in the civicrm_log table
57 * Date and time the item was created
63 * Date and time of the source transaction
67 public $transaction_date;
69 * FK to Contact ID of contact the item is from
75 * Human readable description of this item, to ease display without lookup of source item.
81 * Total amount of this item
87 * Currency for the amount
93 * FK to civicrm_financial_account
97 public $financial_account_id;
99 * Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)
105 * The table providing the source of this item such as civicrm_line_item
109 public $entity_table;
111 * The specific source item that is responsible for the creation of this financial_item
119 * @return civicrm_financial_item
121 function __construct() {
122 $this->__table
= 'civicrm_financial_item';
123 parent
::__construct();
126 * Returns foreign keys and entity references
129 * [CRM_Core_Reference_Interface]
131 static function getReferenceColumns() {
132 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
133 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
134 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
135 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id');
136 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
137 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
139 return Civi
::$statics[__CLASS__
]['links'];
142 * Returns all the column names of this table
146 static function &fields() {
147 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
148 Civi
::$statics[__CLASS__
]['fields'] = array(
151 'type' => CRM_Utils_Type
::T_INT
,
152 'title' => ts('Financial Item ID') ,
155 'created_date' => array(
156 'name' => 'created_date',
157 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
158 'title' => ts('Financial Item Created Date') ,
159 'description' => 'Date and time the item was created',
161 'default' => 'CURRENT_TIMESTAMP',
163 'transaction_date' => array(
164 'name' => 'transaction_date',
165 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
166 'title' => ts('Financial Item Transaction Date') ,
167 'description' => 'Date and time of the source transaction',
170 'contact_id' => array(
171 'name' => 'contact_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Financial Item Contact ID') ,
174 'description' => 'FK to Contact ID of contact the item is from',
177 'where' => 'civicrm_financial_item.contact_id',
178 'headerPattern' => '',
180 'FKClassName' => 'CRM_Contact_DAO_Contact',
182 'description' => array(
183 'name' => 'description',
184 'type' => CRM_Utils_Type
::T_STRING
,
185 'title' => ts('Financial Item Description') ,
186 'description' => 'Human readable description of this item, to ease display without lookup of source item.',
188 'size' => CRM_Utils_Type
::HUGE
,
192 'type' => CRM_Utils_Type
::T_MONEY
,
193 'title' => ts('Amount') ,
194 'description' => 'Total amount of this item',
196 'precision' => array(
202 'name' => 'currency',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Financial Item Currency') ,
205 'description' => 'Currency for the amount',
207 'size' => CRM_Utils_Type
::FOUR
,
209 'where' => 'civicrm_financial_item.currency',
210 'headerPattern' => '',
215 'pseudoconstant' => array(
216 'table' => 'civicrm_currency',
217 'keyColumn' => 'name',
218 'labelColumn' => 'full_name',
219 'nameColumn' => 'name',
222 'financial_account_id' => array(
223 'name' => 'financial_account_id',
224 'type' => CRM_Utils_Type
::T_INT
,
225 'title' => ts('Financial Account ID') ,
226 'description' => 'FK to civicrm_financial_account',
227 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
231 'pseudoconstant' => array(
232 'table' => 'civicrm_financial_account',
234 'labelColumn' => 'name',
237 'status_id' => array(
238 'name' => 'status_id',
239 'type' => CRM_Utils_Type
::T_INT
,
240 'title' => ts('Financial Item Status ID') ,
241 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)',
243 'where' => 'civicrm_financial_item.status_id',
244 'headerPattern' => '',
249 'pseudoconstant' => array(
250 'optionGroupName' => 'financial_item_status',
251 'optionEditPath' => 'civicrm/admin/options/financial_item_status',
254 'entity_table' => array(
255 'name' => 'entity_table',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Entity Table') ,
258 'description' => 'The table providing the source of this item such as civicrm_line_item',
260 'size' => CRM_Utils_Type
::BIG
,
262 'entity_id' => array(
263 'name' => 'entity_id',
264 'type' => CRM_Utils_Type
::T_INT
,
265 'title' => ts('Entity ID') ,
266 'description' => 'The specific source item that is responsible for the creation of this financial_item',
269 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
271 return Civi
::$statics[__CLASS__
]['fields'];
274 * Return a mapping from field-name to the corresponding key (as used in fields()).
277 * Array(string $name => string $uniqueName).
279 static function &fieldKeys() {
280 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
281 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
283 return Civi
::$statics[__CLASS__
]['fieldKeys'];
286 * Returns the names of this table
290 static function getTableName() {
291 return self
::$_tableName;
294 * Returns if this table needs to be logged
302 * Returns the list of fields that can be imported
304 * @param bool $prefix
308 static function &import($prefix = false) {
309 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_item', $prefix, array());
313 * Returns the list of fields that can be exported
315 * @param bool $prefix
319 static function &export($prefix = false) {
320 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_item', $prefix, array());