3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
31 * Generated from xml/schema/CRM/Price/LineItem.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Price_DAO_LineItem
extends CRM_Core_DAO
{
38 * static instance to hold the table name
42 static $_tableName = 'civicrm_line_item';
44 * static instance to hold the field values
48 static $_fields = null;
50 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
60 static $_links = null;
62 * static instance to hold the values that can
67 static $_import = null;
69 * static instance to hold the values that can
74 static $_export = null;
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
89 * table which has the transaction
101 * FK to civicrm_contribution
105 public $contribution_id;
107 * FK to civicrm_price_field
111 public $price_field_id;
113 * descriptive label for item - from price_field_value.label
119 * How many items ordered
137 * Participant count for field
141 public $participant_count;
143 * FK to civicrm_price_field_value
147 public $price_field_value_id;
149 * FK to Financial Type.
153 public $financial_type_id;
155 * Tax-deductible portion of the amount
159 public $deductible_amount;
169 * @return civicrm_line_item
171 function __construct() {
172 $this->__table
= 'civicrm_line_item';
173 parent
::__construct();
176 * Returns foreign keys and entity references
179 * [CRM_Core_Reference_Interface]
181 static function getReferenceColumns() {
182 if (!self
::$_links) {
183 self
::$_links = static ::createReferenceColumns(__CLASS__
);
184 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contribution_id', 'civicrm_contribution', 'id');
185 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
186 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'price_field_value_id', 'civicrm_price_field_value', 'id');
187 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
188 self
::$_links[] = new CRM_Core_Reference_Dynamic(self
::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
190 return self
::$_links;
193 * Returns all the column names of this table
197 static function &fields() {
198 if (!(self
::$_fields)) {
199 self
::$_fields = array(
202 'type' => CRM_Utils_Type
::T_INT
,
203 'title' => ts('Line Item ID') ,
204 'description' => 'Line Item',
207 'entity_table' => array(
208 'name' => 'entity_table',
209 'type' => CRM_Utils_Type
::T_STRING
,
210 'title' => ts('Line Item Entity Type') ,
211 'description' => 'table which has the transaction',
214 'size' => CRM_Utils_Type
::BIG
,
216 'entity_id' => array(
217 'name' => 'entity_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Line Item Entity') ,
220 'description' => 'entry in table',
223 'contribution_id' => array(
224 'name' => 'contribution_id',
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Line Item Contribution') ,
227 'description' => 'FK to civicrm_contribution',
228 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
230 'price_field_id' => array(
231 'name' => 'price_field_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Line Item Price Field') ,
234 'description' => 'FK to civicrm_price_field',
235 'FKClassName' => 'CRM_Price_DAO_PriceField',
239 'type' => CRM_Utils_Type
::T_STRING
,
240 'title' => ts('Line Item Label') ,
241 'description' => 'descriptive label for item - from price_field_value.label',
243 'size' => CRM_Utils_Type
::HUGE
,
251 'type' => CRM_Utils_Type
::T_MONEY
,
252 'title' => ts('Line Item Quantity') ,
253 'description' => 'How many items ordered',
255 'precision' => array(
263 'unit_price' => array(
264 'name' => 'unit_price',
265 'type' => CRM_Utils_Type
::T_MONEY
,
266 'title' => ts('Unit Price') ,
267 'description' => 'price of each item',
269 'precision' => array(
277 'line_total' => array(
278 'name' => 'line_total',
279 'type' => CRM_Utils_Type
::T_MONEY
,
280 'title' => ts('Line Item Total') ,
281 'description' => 'qty * unit_price',
283 'precision' => array(
288 'participant_count' => array(
289 'name' => 'participant_count',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Line Item Participant Count') ,
292 'description' => 'Participant count for field',
298 'price_field_value_id' => array(
299 'name' => 'price_field_value_id',
300 'type' => CRM_Utils_Type
::T_INT
,
301 'title' => ts('Line Item Option') ,
302 'description' => 'FK to civicrm_price_field_value',
304 'FKClassName' => 'CRM_Price_DAO_PriceFieldValue',
306 'financial_type_id' => array(
307 'name' => 'financial_type_id',
308 'type' => CRM_Utils_Type
::T_INT
,
309 'title' => ts('Financial Type') ,
310 'description' => 'FK to Financial Type.',
312 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
316 'pseudoconstant' => array(
317 'table' => 'civicrm_financial_type',
319 'labelColumn' => 'name',
322 'deductible_amount' => array(
323 'name' => 'deductible_amount',
324 'type' => CRM_Utils_Type
::T_MONEY
,
325 'title' => ts('Deductible Amount') ,
326 'description' => 'Tax-deductible portion of the amount',
328 'precision' => array(
337 'tax_amount' => array(
338 'name' => 'tax_amount',
339 'type' => CRM_Utils_Type
::T_MONEY
,
340 'title' => ts('Tax Amount') ,
341 'description' => 'tax of each item',
342 'precision' => array(
347 'where' => 'civicrm_line_item.tax_amount',
348 'headerPattern' => '/tax(.?am(ou)?nt)?/i',
349 'dataPattern' => '/^\d+(\.\d{2})?$/',
357 return self
::$_fields;
360 * Returns an array containing, for each field, the arary key used for that
361 * field in self::$_fields.
365 static function &fieldKeys() {
366 if (!(self
::$_fieldKeys)) {
367 self
::$_fieldKeys = array(
369 'entity_table' => 'entity_table',
370 'entity_id' => 'entity_id',
371 'contribution_id' => 'contribution_id',
372 'price_field_id' => 'price_field_id',
375 'unit_price' => 'unit_price',
376 'line_total' => 'line_total',
377 'participant_count' => 'participant_count',
378 'price_field_value_id' => 'price_field_value_id',
379 'financial_type_id' => 'financial_type_id',
380 'deductible_amount' => 'deductible_amount',
381 'tax_amount' => 'tax_amount',
384 return self
::$_fieldKeys;
387 * Returns the names of this table
391 static function getTableName() {
392 return self
::$_tableName;
395 * Returns if this table needs to be logged
403 * Returns the list of fields that can be imported
405 * @param bool $prefix
409 static function &import($prefix = false) {
410 if (!(self
::$_import)) {
411 self
::$_import = array();
412 $fields = self
::fields();
413 foreach($fields as $name => $field) {
414 if (CRM_Utils_Array
::value('import', $field)) {
416 self
::$_import['line_item'] = & $fields[$name];
418 self
::$_import[$name] = & $fields[$name];
423 return self
::$_import;
426 * Returns the list of fields that can be exported
428 * @param bool $prefix
432 static function &export($prefix = false) {
433 if (!(self
::$_export)) {
434 self
::$_export = array();
435 $fields = self
::fields();
436 foreach($fields as $name => $field) {
437 if (CRM_Utils_Array
::value('export', $field)) {
439 self
::$_export['line_item'] = & $fields[$name];
441 self
::$_export[$name] = & $fields[$name];
446 return self
::$_export;