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:090a94af55641978012615f30c962781)
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',
158 'created_date' => array(
159 'name' => 'created_date',
160 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
161 'title' => ts('Financial Item Created Date') ,
162 'description' => 'Date and time the item was created',
164 'default' => 'CURRENT_TIMESTAMP',
165 'table_name' => 'civicrm_financial_item',
166 'entity' => 'FinancialItem',
167 'bao' => 'CRM_Financial_BAO_FinancialItem',
169 'transaction_date' => array(
170 'name' => 'transaction_date',
171 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
172 'title' => ts('Financial Item Transaction Date') ,
173 'description' => 'Date and time of the source transaction',
175 'table_name' => 'civicrm_financial_item',
176 'entity' => 'FinancialItem',
177 'bao' => 'CRM_Financial_BAO_FinancialItem',
179 'contact_id' => array(
180 'name' => 'contact_id',
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('Financial Item Contact ID') ,
183 'description' => 'FK to Contact ID of contact the item is from',
186 'where' => 'civicrm_financial_item.contact_id',
187 'headerPattern' => '',
189 'table_name' => 'civicrm_financial_item',
190 'entity' => 'FinancialItem',
191 'bao' => 'CRM_Financial_BAO_FinancialItem',
192 'FKClassName' => 'CRM_Contact_DAO_Contact',
194 'description' => array(
195 'name' => 'description',
196 'type' => CRM_Utils_Type
::T_STRING
,
197 'title' => ts('Financial Item Description') ,
198 'description' => 'Human readable description of this item, to ease display without lookup of source item.',
200 'size' => CRM_Utils_Type
::HUGE
,
201 'table_name' => 'civicrm_financial_item',
202 'entity' => 'FinancialItem',
203 'bao' => 'CRM_Financial_BAO_FinancialItem',
207 'type' => CRM_Utils_Type
::T_MONEY
,
208 'title' => ts('Amount') ,
209 'description' => 'Total amount of this item',
211 'precision' => array(
215 'table_name' => 'civicrm_financial_item',
216 'entity' => 'FinancialItem',
217 'bao' => 'CRM_Financial_BAO_FinancialItem',
220 'name' => 'currency',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Financial Item Currency') ,
223 'description' => 'Currency for the amount',
225 'size' => CRM_Utils_Type
::FOUR
,
227 'where' => 'civicrm_financial_item.currency',
228 'headerPattern' => '',
230 'table_name' => 'civicrm_financial_item',
231 'entity' => 'FinancialItem',
232 'bao' => 'CRM_Financial_BAO_FinancialItem',
236 'pseudoconstant' => array(
237 'table' => 'civicrm_currency',
238 'keyColumn' => 'name',
239 'labelColumn' => 'full_name',
240 'nameColumn' => 'name',
243 'financial_account_id' => array(
244 'name' => 'financial_account_id',
245 'type' => CRM_Utils_Type
::T_INT
,
246 'title' => ts('Financial Account ID') ,
247 'description' => 'FK to civicrm_financial_account',
248 'table_name' => 'civicrm_financial_item',
249 'entity' => 'FinancialItem',
250 'bao' => 'CRM_Financial_BAO_FinancialItem',
251 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
255 'pseudoconstant' => array(
256 'table' => 'civicrm_financial_account',
258 'labelColumn' => 'name',
261 'status_id' => array(
262 'name' => 'status_id',
263 'type' => CRM_Utils_Type
::T_INT
,
264 'title' => ts('Financial Item Status ID') ,
265 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)',
267 'where' => 'civicrm_financial_item.status_id',
268 'headerPattern' => '',
270 'table_name' => 'civicrm_financial_item',
271 'entity' => 'FinancialItem',
272 'bao' => 'CRM_Financial_BAO_FinancialItem',
276 'pseudoconstant' => array(
277 'optionGroupName' => 'financial_item_status',
278 'optionEditPath' => 'civicrm/admin/options/financial_item_status',
281 'entity_table' => array(
282 'name' => 'entity_table',
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('Entity Table') ,
285 'description' => 'The table providing the source of this item such as civicrm_line_item',
287 'size' => CRM_Utils_Type
::BIG
,
288 'table_name' => 'civicrm_financial_item',
289 'entity' => 'FinancialItem',
290 'bao' => 'CRM_Financial_BAO_FinancialItem',
292 'entity_id' => array(
293 'name' => 'entity_id',
294 'type' => CRM_Utils_Type
::T_INT
,
295 'title' => ts('Entity ID') ,
296 'description' => 'The specific source item that is responsible for the creation of this financial_item',
297 'table_name' => 'civicrm_financial_item',
298 'entity' => 'FinancialItem',
299 'bao' => 'CRM_Financial_BAO_FinancialItem',
302 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
304 return Civi
::$statics[__CLASS__
]['fields'];
307 * Return a mapping from field-name to the corresponding key (as used in fields()).
310 * Array(string $name => string $uniqueName).
312 static function &fieldKeys() {
313 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
314 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
316 return Civi
::$statics[__CLASS__
]['fieldKeys'];
319 * Returns the names of this table
323 static function getTableName() {
324 return self
::$_tableName;
327 * Returns if this table needs to be logged
335 * Returns the list of fields that can be imported
337 * @param bool $prefix
341 static function &import($prefix = false) {
342 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_item', $prefix, array());
346 * Returns the list of fields that can be exported
348 * @param bool $prefix
352 static function &export($prefix = false) {
353 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_item', $prefix, array());