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/FinancialItem.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:95e199969f4ff93ccae635fb7e0d30f2)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Financial_DAO_FinancialItem constructor.
40 class CRM_Financial_DAO_FinancialItem
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_financial_item';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
59 * Date and time the item was created
65 * Date and time of the source transaction
69 public $transaction_date;
71 * FK to Contact ID of contact the item is from
77 * Human readable description of this item, to ease display without lookup of source item.
83 * Total amount of this item
89 * Currency for the amount
95 * FK to civicrm_financial_account
99 public $financial_account_id;
101 * Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)
107 * The table providing the source of this item such as civicrm_line_item
111 public $entity_table;
113 * The specific source item that is responsible for the creation of this 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') ,
154 'table_name' => 'civicrm_financial_item',
155 'entity' => 'FinancialItem',
156 'bao' => 'CRM_Financial_BAO_FinancialItem',
159 'created_date' => array(
160 'name' => 'created_date',
161 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
162 'title' => ts('Financial Item Created Date') ,
163 'description' => 'Date and time the item was created',
165 'default' => 'CURRENT_TIMESTAMP',
166 'table_name' => 'civicrm_financial_item',
167 'entity' => 'FinancialItem',
168 'bao' => 'CRM_Financial_BAO_FinancialItem',
171 'transaction_date' => array(
172 'name' => 'transaction_date',
173 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
174 'title' => ts('Financial Item Transaction Date') ,
175 'description' => 'Date and time of the source transaction',
177 'table_name' => 'civicrm_financial_item',
178 'entity' => 'FinancialItem',
179 'bao' => 'CRM_Financial_BAO_FinancialItem',
182 'contact_id' => array(
183 'name' => 'contact_id',
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Financial Item Contact ID') ,
186 'description' => 'FK to Contact ID of contact the item is from',
189 'where' => 'civicrm_financial_item.contact_id',
190 'headerPattern' => '',
192 'table_name' => 'civicrm_financial_item',
193 'entity' => 'FinancialItem',
194 'bao' => 'CRM_Financial_BAO_FinancialItem',
196 'FKClassName' => 'CRM_Contact_DAO_Contact',
198 'description' => array(
199 'name' => 'description',
200 'type' => CRM_Utils_Type
::T_STRING
,
201 'title' => ts('Financial Item Description') ,
202 'description' => 'Human readable description of this item, to ease display without lookup of source item.',
204 'size' => CRM_Utils_Type
::HUGE
,
205 'table_name' => 'civicrm_financial_item',
206 'entity' => 'FinancialItem',
207 'bao' => 'CRM_Financial_BAO_FinancialItem',
212 'type' => CRM_Utils_Type
::T_MONEY
,
213 'title' => ts('Amount') ,
214 'description' => 'Total amount of this item',
216 'precision' => array(
220 'table_name' => 'civicrm_financial_item',
221 'entity' => 'FinancialItem',
222 'bao' => 'CRM_Financial_BAO_FinancialItem',
226 'name' => 'currency',
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Financial Item Currency') ,
229 'description' => 'Currency for the amount',
231 'size' => CRM_Utils_Type
::FOUR
,
233 'where' => 'civicrm_financial_item.currency',
234 'headerPattern' => '',
236 'table_name' => 'civicrm_financial_item',
237 'entity' => 'FinancialItem',
238 'bao' => 'CRM_Financial_BAO_FinancialItem',
243 'pseudoconstant' => array(
244 'table' => 'civicrm_currency',
245 'keyColumn' => 'name',
246 'labelColumn' => 'full_name',
247 'nameColumn' => 'name',
250 'financial_account_id' => array(
251 'name' => 'financial_account_id',
252 'type' => CRM_Utils_Type
::T_INT
,
253 'title' => ts('Financial Account ID') ,
254 'description' => 'FK to civicrm_financial_account',
255 'table_name' => 'civicrm_financial_item',
256 'entity' => 'FinancialItem',
257 'bao' => 'CRM_Financial_BAO_FinancialItem',
259 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
263 'pseudoconstant' => array(
264 'table' => 'civicrm_financial_account',
266 'labelColumn' => 'name',
269 'status_id' => array(
270 'name' => 'status_id',
271 'type' => CRM_Utils_Type
::T_INT
,
272 'title' => ts('Financial Item Status ID') ,
273 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)',
275 'where' => 'civicrm_financial_item.status_id',
276 'headerPattern' => '',
278 'table_name' => 'civicrm_financial_item',
279 'entity' => 'FinancialItem',
280 'bao' => 'CRM_Financial_BAO_FinancialItem',
285 'pseudoconstant' => array(
286 'optionGroupName' => 'financial_item_status',
287 'optionEditPath' => 'civicrm/admin/options/financial_item_status',
290 'entity_table' => array(
291 'name' => 'entity_table',
292 'type' => CRM_Utils_Type
::T_STRING
,
293 'title' => ts('Entity Table') ,
294 'description' => 'The table providing the source of this item such as civicrm_line_item',
296 'size' => CRM_Utils_Type
::BIG
,
297 'table_name' => 'civicrm_financial_item',
298 'entity' => 'FinancialItem',
299 'bao' => 'CRM_Financial_BAO_FinancialItem',
302 'entity_id' => array(
303 'name' => 'entity_id',
304 'type' => CRM_Utils_Type
::T_INT
,
305 'title' => ts('Entity ID') ,
306 'description' => 'The specific source item that is responsible for the creation of this financial_item',
307 'table_name' => 'civicrm_financial_item',
308 'entity' => 'FinancialItem',
309 'bao' => 'CRM_Financial_BAO_FinancialItem',
313 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
315 return Civi
::$statics[__CLASS__
]['fields'];
318 * Return a mapping from field-name to the corresponding key (as used in fields()).
321 * Array(string $name => string $uniqueName).
323 static function &fieldKeys() {
324 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
325 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
327 return Civi
::$statics[__CLASS__
]['fieldKeys'];
330 * Returns the names of this table
334 static function getTableName() {
335 return self
::$_tableName;
338 * Returns if this table needs to be logged
346 * Returns the list of fields that can be imported
348 * @param bool $prefix
352 static function &import($prefix = false) {
353 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_item', $prefix, array());
357 * Returns the list of fields that can be exported
359 * @param bool $prefix
363 static function &export($prefix = false) {
364 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_item', $prefix, array());
368 * Returns the list of indices
370 public static function indices($localize = TRUE) {
372 'IX_created_date' => array(
373 'name' => 'IX_created_date',
377 'localizable' => false,
378 'sig' => 'civicrm_financial_item::0::created_date',
380 'IX_transaction_date' => array(
381 'name' => 'IX_transaction_date',
383 0 => 'transaction_date',
385 'localizable' => false,
386 'sig' => 'civicrm_financial_item::0::transaction_date',
388 'index_entity_id_entity_table' => array(
389 'name' => 'index_entity_id_entity_table',
394 'localizable' => false,
395 'sig' => 'civicrm_financial_item::0::entity_id::entity_table',
398 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;