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/Price/LineItem.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:db7c7e55df64ed93a7152b5297d13d25)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Price_DAO_LineItem constructor.
40 class CRM_Price_DAO_LineItem
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_line_item';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * table which has the transaction
72 * FK to civicrm_contribution
76 public $contribution_id;
78 * FK to civicrm_price_field
82 public $price_field_id;
84 * descriptive label for item - from price_field_value.label
90 * How many items ordered
108 * Participant count for field
112 public $participant_count;
114 * FK to civicrm_price_field_value
118 public $price_field_value_id;
120 * FK to Financial Type.
124 public $financial_type_id;
126 * Portion of total amount which is NOT tax deductible.
130 public $non_deductible_amount;
140 function __construct() {
141 $this->__table
= 'civicrm_line_item';
142 parent
::__construct();
145 * Returns foreign keys and entity references.
148 * [CRM_Core_Reference_Interface]
150 static function getReferenceColumns() {
151 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
152 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
153 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contribution_id', 'civicrm_contribution', 'id');
154 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
155 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'price_field_value_id', 'civicrm_price_field_value', 'id');
156 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
157 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
158 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
160 return Civi
::$statics[__CLASS__
]['links'];
163 * Returns all the column names of this table
167 static function &fields() {
168 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
169 Civi
::$statics[__CLASS__
]['fields'] = array(
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Line Item ID') ,
174 'description' => 'Line Item',
176 'table_name' => 'civicrm_line_item',
177 'entity' => 'LineItem',
178 'bao' => 'CRM_Price_BAO_LineItem',
181 'entity_table' => array(
182 'name' => 'entity_table',
183 'type' => CRM_Utils_Type
::T_STRING
,
184 'title' => ts('Line Item Entity Type') ,
185 'description' => 'table which has the transaction',
188 'size' => CRM_Utils_Type
::BIG
,
189 'table_name' => 'civicrm_line_item',
190 'entity' => 'LineItem',
191 'bao' => 'CRM_Price_BAO_LineItem',
194 'entity_id' => array(
195 'name' => 'entity_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Line Item Entity') ,
198 'description' => 'entry in table',
200 'table_name' => 'civicrm_line_item',
201 'entity' => 'LineItem',
202 'bao' => 'CRM_Price_BAO_LineItem',
205 'contribution_id' => array(
206 'name' => 'contribution_id',
207 'type' => CRM_Utils_Type
::T_INT
,
208 'title' => ts('Line Item Contribution') ,
209 'description' => 'FK to civicrm_contribution',
210 'table_name' => 'civicrm_line_item',
211 'entity' => 'LineItem',
212 'bao' => 'CRM_Price_BAO_LineItem',
214 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
216 'price_field_id' => array(
217 'name' => 'price_field_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Line Item Price Field') ,
220 'description' => 'FK to civicrm_price_field',
221 'table_name' => 'civicrm_line_item',
222 'entity' => 'LineItem',
223 'bao' => 'CRM_Price_BAO_LineItem',
225 'FKClassName' => 'CRM_Price_DAO_PriceField',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('Line Item Label') ,
231 'description' => 'descriptive label for item - from price_field_value.label',
233 'size' => CRM_Utils_Type
::HUGE
,
235 'table_name' => 'civicrm_line_item',
236 'entity' => 'LineItem',
237 'bao' => 'CRM_Price_BAO_LineItem',
245 'type' => CRM_Utils_Type
::T_MONEY
,
246 'title' => ts('Line Item Quantity') ,
247 'description' => 'How many items ordered',
249 'precision' => array(
253 'table_name' => 'civicrm_line_item',
254 'entity' => 'LineItem',
255 'bao' => 'CRM_Price_BAO_LineItem',
261 'unit_price' => array(
262 'name' => 'unit_price',
263 'type' => CRM_Utils_Type
::T_MONEY
,
264 'title' => ts('Unit Price') ,
265 'description' => 'price of each item',
267 'precision' => array(
271 'table_name' => 'civicrm_line_item',
272 'entity' => 'LineItem',
273 'bao' => 'CRM_Price_BAO_LineItem',
279 'line_total' => array(
280 'name' => 'line_total',
281 'type' => CRM_Utils_Type
::T_MONEY
,
282 'title' => ts('Line Item Total') ,
283 'description' => 'qty * unit_price',
285 'precision' => array(
289 'table_name' => 'civicrm_line_item',
290 'entity' => 'LineItem',
291 'bao' => 'CRM_Price_BAO_LineItem',
294 'participant_count' => array(
295 'name' => 'participant_count',
296 'type' => CRM_Utils_Type
::T_INT
,
297 'title' => ts('Line Item Participant Count') ,
298 'description' => 'Participant count for field',
300 'table_name' => 'civicrm_line_item',
301 'entity' => 'LineItem',
302 'bao' => 'CRM_Price_BAO_LineItem',
308 'price_field_value_id' => array(
309 'name' => 'price_field_value_id',
310 'type' => CRM_Utils_Type
::T_INT
,
311 'title' => ts('Line Item Option') ,
312 'description' => 'FK to civicrm_price_field_value',
314 'table_name' => 'civicrm_line_item',
315 'entity' => 'LineItem',
316 'bao' => 'CRM_Price_BAO_LineItem',
318 'FKClassName' => 'CRM_Price_DAO_PriceFieldValue',
320 'financial_type_id' => array(
321 'name' => 'financial_type_id',
322 'type' => CRM_Utils_Type
::T_INT
,
323 'title' => ts('Financial Type') ,
324 'description' => 'FK to Financial Type.',
326 'table_name' => 'civicrm_line_item',
327 'entity' => 'LineItem',
328 'bao' => 'CRM_Price_BAO_LineItem',
330 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
334 'pseudoconstant' => array(
335 'table' => 'civicrm_financial_type',
337 'labelColumn' => 'name',
340 'non_deductible_amount' => array(
341 'name' => 'non_deductible_amount',
342 'type' => CRM_Utils_Type
::T_MONEY
,
343 'title' => ts('Non-deductible Amount') ,
344 'description' => 'Portion of total amount which is NOT tax deductible.',
346 'precision' => array(
351 'table_name' => 'civicrm_line_item',
352 'entity' => 'LineItem',
353 'bao' => 'CRM_Price_BAO_LineItem',
359 'tax_amount' => array(
360 'name' => 'tax_amount',
361 'type' => CRM_Utils_Type
::T_MONEY
,
362 'title' => ts('Tax Amount') ,
363 'description' => 'tax of each item',
364 'precision' => array(
369 'where' => 'civicrm_line_item.tax_amount',
370 'headerPattern' => '/tax(.?am(ou)?nt)?/i',
371 'dataPattern' => '/^\d+(\.\d{2})?$/',
373 'table_name' => 'civicrm_line_item',
374 'entity' => 'LineItem',
375 'bao' => 'CRM_Price_BAO_LineItem',
382 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
384 return Civi
::$statics[__CLASS__
]['fields'];
387 * Return a mapping from field-name to the corresponding key (as used in fields()).
390 * Array(string $name => string $uniqueName).
392 static function &fieldKeys() {
393 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
394 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
396 return Civi
::$statics[__CLASS__
]['fieldKeys'];
399 * Returns the names of this table
403 static function getTableName() {
404 return self
::$_tableName;
407 * Returns if this table needs to be logged
415 * Returns the list of fields that can be imported
417 * @param bool $prefix
421 static function &import($prefix = false) {
422 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'line_item', $prefix, array());
426 * Returns the list of fields that can be exported
428 * @param bool $prefix
432 static function &export($prefix = false) {
433 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'line_item', $prefix, array());
437 * Returns the list of indices
439 public static function indices($localize = TRUE) {
441 'index_entity' => array(
442 'name' => 'index_entity',
447 'localizable' => false,
448 'sig' => 'civicrm_line_item::0::entity_table::entity_id',
450 'UI_line_item_value' => array(
451 'name' => 'UI_line_item_value',
455 2 => 'contribution_id',
456 3 => 'price_field_value_id',
457 4 => 'price_field_id',
459 'localizable' => false,
461 'sig' => 'civicrm_line_item::1::entity_table::entity_id::contribution_id::price_field_value_id::price_field_id',
464 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;