3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
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 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2015
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
38 * Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem
40 class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem
extends CRM_Core_DAO
{
42 * static instance to hold the table name
46 static $_tableName = 'civicrm_line_item';
48 * static instance to hold the field values
52 static $_fields = NULL;
54 * static instance to hold the FK relationships
58 static $_links = NULL;
60 * static instance to hold the values that can
65 static $_import = NULL;
67 * static instance to hold the values that can
72 static $_export = NULL;
74 * static value to see if we should log any modifications to
75 * this table in the civicrm_log table
87 * table which has the transaction
103 public $price_field_id;
105 * descriptive label for item - from price_field_value.label
111 * How many items ordered
129 * Participant count for field
133 public $participant_count;
135 * Implicit FK to civicrm_option_value
139 public $price_field_value_id;
144 * @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem
146 public function __construct() {
147 $this->__table
= 'civicrm_line_item';
148 parent
::__construct();
152 * Return foreign links.
156 public function links() {
157 if (!(self
::$_links)) {
158 self
::$_links = array(
159 'price_field_id' => 'civicrm_price_field:id',
160 'price_field_value_id' => 'civicrm_price_field_value:id',
163 return self
::$_links;
167 * Returns all the column names of this table.
171 static function &fields() {
172 if (!(self
::$_fields)) {
173 self
::$_fields = array(
176 'type' => CRM_Utils_Type
::T_INT
,
179 'entity_table' => array(
180 'name' => 'entity_table',
181 'type' => CRM_Utils_Type
::T_STRING
,
182 'title' => ts('Entity Table'),
185 'size' => CRM_Utils_Type
::BIG
,
187 'entity_id' => array(
188 'name' => 'entity_id',
189 'type' => CRM_Utils_Type
::T_INT
,
192 'price_field_id' => array(
193 'name' => 'price_field_id',
194 'type' => CRM_Utils_Type
::T_INT
,
196 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
200 'type' => CRM_Utils_Type
::T_STRING
,
201 'title' => ts('Label'),
203 'size' => CRM_Utils_Type
::HUGE
,
208 'type' => CRM_Utils_Type
::T_INT
,
209 'title' => ts('Qty'),
212 'unit_price' => array(
213 'name' => 'unit_price',
214 'type' => CRM_Utils_Type
::T_MONEY
,
215 'title' => ts('Unit Price'),
218 'line_total' => array(
219 'name' => 'line_total',
220 'type' => CRM_Utils_Type
::T_MONEY
,
221 'title' => ts('Line Total'),
224 'participant_count' => array(
225 'name' => 'participant_count',
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Participant Count'),
230 'price_field_value_id' => array(
231 'name' => 'price_field_value_id',
232 'type' => CRM_Utils_Type
::T_INT
,
234 'FKClassName' => 'Snapshot_v4p2_Price_DAO_FieldValue',
238 return self
::$_fields;
242 * returns the names of this table.
246 public static function getTableName() {
247 return self
::$_tableName;
251 * returns if this table needs to be logged.
255 public function getLog() {
260 * returns the list of fields that can be imported.
262 * @param bool $prefix
266 static function &import($prefix = FALSE) {
267 if (!(self
::$_import)) {
268 self
::$_import = array();
269 $fields = self
::fields();
270 foreach ($fields as $name => $field) {
271 if (!empty($field['import'])) {
273 self
::$_import['line_item'] = &$fields[$name];
276 self
::$_import[$name] = &$fields[$name];
281 return self
::$_import;
285 * Returns the list of fields that can be exported.
287 * @param bool $prefix
291 static function &export($prefix = FALSE) {
292 if (!(self
::$_export)) {
293 self
::$_export = array();
294 $fields = self
::fields();
295 foreach ($fields as $name => $field) {
296 if (!empty($field['export'])) {
298 self
::$_export['line_item'] = &$fields[$name];
301 self
::$_export[$name] = &$fields[$name];
306 return self
::$_export;