Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Price/LineItem.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
5afce5ad | 33 | * (GenCodeChecksum:b80ad6c535fb23d2a40fc36104895a79) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Price_DAO_LineItem extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_line_item'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = true; | |
51 | /** | |
52 | * Line Item | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * table which has the transaction | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $entity_table; | |
63 | /** | |
64 | * entry in table | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $entity_id; | |
69 | /** | |
70 | * FK to civicrm_contribution | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $contribution_id; | |
75 | /** | |
76 | * FK to civicrm_price_field | |
77 | * | |
78 | * @var int unsigned | |
79 | */ | |
80 | public $price_field_id; | |
81 | /** | |
82 | * descriptive label for item - from price_field_value.label | |
83 | * | |
84 | * @var string | |
85 | */ | |
86 | public $label; | |
87 | /** | |
88 | * How many items ordered | |
89 | * | |
90 | * @var float | |
91 | */ | |
92 | public $qty; | |
93 | /** | |
94 | * price of each item | |
95 | * | |
96 | * @var float | |
97 | */ | |
98 | public $unit_price; | |
99 | /** | |
100 | * qty * unit_price | |
101 | * | |
102 | * @var float | |
103 | */ | |
104 | public $line_total; | |
105 | /** | |
106 | * Participant count for field | |
107 | * | |
108 | * @var int unsigned | |
109 | */ | |
110 | public $participant_count; | |
111 | /** | |
112 | * FK to civicrm_price_field_value | |
113 | * | |
114 | * @var int unsigned | |
115 | */ | |
116 | public $price_field_value_id; | |
117 | /** | |
118 | * FK to Financial Type. | |
119 | * | |
120 | * @var int unsigned | |
121 | */ | |
122 | public $financial_type_id; | |
123 | /** | |
5afce5ad | 124 | * Portion of total amount which is NOT tax deductible. |
e501603b TO |
125 | * |
126 | * @var float | |
127 | */ | |
5afce5ad | 128 | public $non_deductible_amount; |
e501603b TO |
129 | /** |
130 | * tax of each item | |
131 | * | |
132 | * @var float | |
133 | */ | |
134 | public $tax_amount; | |
135 | /** | |
136 | * class constructor | |
137 | * | |
138 | * @return civicrm_line_item | |
139 | */ | |
140 | function __construct() { | |
141 | $this->__table = 'civicrm_line_item'; | |
142 | parent::__construct(); | |
143 | } | |
144 | /** | |
145 | * Returns foreign keys and entity references | |
146 | * | |
147 | * @return array | |
148 | * [CRM_Core_Reference_Interface] | |
149 | */ | |
150 | static function getReferenceColumns() { | |
346aaaba TO |
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']); | |
e501603b | 159 | } |
346aaaba | 160 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
161 | } |
162 | /** | |
163 | * Returns all the column names of this table | |
164 | * | |
165 | * @return array | |
166 | */ | |
167 | static function &fields() { | |
346aaaba TO |
168 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
169 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
170 | 'id' => array( |
171 | 'name' => 'id', | |
172 | 'type' => CRM_Utils_Type::T_INT, | |
173 | 'title' => ts('Line Item ID') , | |
174 | 'description' => 'Line Item', | |
175 | 'required' => true, | |
176 | ) , | |
177 | 'entity_table' => array( | |
178 | 'name' => 'entity_table', | |
179 | 'type' => CRM_Utils_Type::T_STRING, | |
180 | 'title' => ts('Line Item Entity Type') , | |
181 | 'description' => 'table which has the transaction', | |
182 | 'required' => true, | |
183 | 'maxlength' => 64, | |
184 | 'size' => CRM_Utils_Type::BIG, | |
185 | ) , | |
186 | 'entity_id' => array( | |
187 | 'name' => 'entity_id', | |
188 | 'type' => CRM_Utils_Type::T_INT, | |
189 | 'title' => ts('Line Item Entity') , | |
190 | 'description' => 'entry in table', | |
191 | 'required' => true, | |
192 | ) , | |
193 | 'contribution_id' => array( | |
194 | 'name' => 'contribution_id', | |
195 | 'type' => CRM_Utils_Type::T_INT, | |
196 | 'title' => ts('Line Item Contribution') , | |
197 | 'description' => 'FK to civicrm_contribution', | |
198 | 'FKClassName' => 'CRM_Contribute_DAO_Contribution', | |
199 | ) , | |
200 | 'price_field_id' => array( | |
201 | 'name' => 'price_field_id', | |
202 | 'type' => CRM_Utils_Type::T_INT, | |
203 | 'title' => ts('Line Item Price Field') , | |
204 | 'description' => 'FK to civicrm_price_field', | |
205 | 'FKClassName' => 'CRM_Price_DAO_PriceField', | |
206 | ) , | |
207 | 'label' => array( | |
208 | 'name' => 'label', | |
209 | 'type' => CRM_Utils_Type::T_STRING, | |
210 | 'title' => ts('Line Item Label') , | |
211 | 'description' => 'descriptive label for item - from price_field_value.label', | |
212 | 'maxlength' => 255, | |
213 | 'size' => CRM_Utils_Type::HUGE, | |
214 | 'default' => 'NULL', | |
215 | 'html' => array( | |
216 | 'type' => 'Text', | |
217 | ) , | |
218 | ) , | |
219 | 'qty' => array( | |
220 | 'name' => 'qty', | |
221 | 'type' => CRM_Utils_Type::T_MONEY, | |
222 | 'title' => ts('Line Item Quantity') , | |
223 | 'description' => 'How many items ordered', | |
224 | 'required' => true, | |
225 | 'precision' => array( | |
226 | 20, | |
227 | 2 | |
228 | ) , | |
229 | 'html' => array( | |
230 | 'type' => 'Text', | |
231 | ) , | |
232 | ) , | |
233 | 'unit_price' => array( | |
234 | 'name' => 'unit_price', | |
235 | 'type' => CRM_Utils_Type::T_MONEY, | |
236 | 'title' => ts('Unit Price') , | |
237 | 'description' => 'price of each item', | |
238 | 'required' => true, | |
239 | 'precision' => array( | |
240 | 20, | |
241 | 2 | |
242 | ) , | |
243 | 'html' => array( | |
244 | 'type' => 'Text', | |
245 | ) , | |
246 | ) , | |
247 | 'line_total' => array( | |
248 | 'name' => 'line_total', | |
249 | 'type' => CRM_Utils_Type::T_MONEY, | |
250 | 'title' => ts('Line Item Total') , | |
251 | 'description' => 'qty * unit_price', | |
252 | 'required' => true, | |
253 | 'precision' => array( | |
254 | 20, | |
255 | 2 | |
256 | ) , | |
257 | ) , | |
258 | 'participant_count' => array( | |
259 | 'name' => 'participant_count', | |
260 | 'type' => CRM_Utils_Type::T_INT, | |
261 | 'title' => ts('Line Item Participant Count') , | |
262 | 'description' => 'Participant count for field', | |
263 | 'default' => 'NULL', | |
264 | 'html' => array( | |
265 | 'type' => 'Text', | |
266 | ) , | |
267 | ) , | |
268 | 'price_field_value_id' => array( | |
269 | 'name' => 'price_field_value_id', | |
270 | 'type' => CRM_Utils_Type::T_INT, | |
271 | 'title' => ts('Line Item Option') , | |
272 | 'description' => 'FK to civicrm_price_field_value', | |
273 | 'default' => 'NULL', | |
274 | 'FKClassName' => 'CRM_Price_DAO_PriceFieldValue', | |
275 | ) , | |
276 | 'financial_type_id' => array( | |
277 | 'name' => 'financial_type_id', | |
278 | 'type' => CRM_Utils_Type::T_INT, | |
279 | 'title' => ts('Financial Type') , | |
280 | 'description' => 'FK to Financial Type.', | |
281 | 'default' => 'NULL', | |
282 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', | |
283 | 'html' => array( | |
284 | 'type' => 'Select', | |
285 | ) , | |
286 | 'pseudoconstant' => array( | |
287 | 'table' => 'civicrm_financial_type', | |
288 | 'keyColumn' => 'id', | |
289 | 'labelColumn' => 'name', | |
290 | ) | |
291 | ) , | |
5afce5ad | 292 | 'non_deductible_amount' => array( |
293 | 'name' => 'non_deductible_amount', | |
e501603b | 294 | 'type' => CRM_Utils_Type::T_MONEY, |
5afce5ad | 295 | 'title' => ts('Non-deductible Amount') , |
296 | 'description' => 'Portion of total amount which is NOT tax deductible.', | |
e501603b TO |
297 | 'required' => true, |
298 | 'precision' => array( | |
299 | 20, | |
300 | 2 | |
301 | ) , | |
302 | 'default' => '0.0', | |
303 | 'html' => array( | |
304 | 'type' => 'Text', | |
305 | ) , | |
306 | ) , | |
307 | 'tax_amount' => array( | |
308 | 'name' => 'tax_amount', | |
309 | 'type' => CRM_Utils_Type::T_MONEY, | |
310 | 'title' => ts('Tax Amount') , | |
311 | 'description' => 'tax of each item', | |
312 | 'precision' => array( | |
313 | 20, | |
314 | 2 | |
315 | ) , | |
316 | 'import' => true, | |
317 | 'where' => 'civicrm_line_item.tax_amount', | |
318 | 'headerPattern' => '/tax(.?am(ou)?nt)?/i', | |
319 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
320 | 'export' => true, | |
321 | 'html' => array( | |
322 | 'type' => 'Text', | |
323 | ) , | |
324 | ) , | |
325 | ); | |
346aaaba | 326 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 327 | } |
346aaaba | 328 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
329 | } |
330 | /** | |
bd8e0b14 | 331 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
332 | * |
333 | * @return array | |
bd8e0b14 | 334 | * Array(string $name => string $uniqueName). |
e501603b TO |
335 | */ |
336 | static function &fieldKeys() { | |
bd8e0b14 TO |
337 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
338 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 339 | } |
bd8e0b14 | 340 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
341 | } |
342 | /** | |
343 | * Returns the names of this table | |
344 | * | |
345 | * @return string | |
346 | */ | |
347 | static function getTableName() { | |
348 | return self::$_tableName; | |
349 | } | |
350 | /** | |
351 | * Returns if this table needs to be logged | |
352 | * | |
353 | * @return boolean | |
354 | */ | |
355 | function getLog() { | |
356 | return self::$_log; | |
357 | } | |
358 | /** | |
359 | * Returns the list of fields that can be imported | |
360 | * | |
361 | * @param bool $prefix | |
362 | * | |
363 | * @return array | |
364 | */ | |
365 | static function &import($prefix = false) { | |
60808919 TO |
366 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'line_item', $prefix, array()); |
367 | return $r; | |
e501603b TO |
368 | } |
369 | /** | |
370 | * Returns the list of fields that can be exported | |
371 | * | |
372 | * @param bool $prefix | |
373 | * | |
374 | * @return array | |
375 | */ | |
376 | static function &export($prefix = false) { | |
60808919 TO |
377 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'line_item', $prefix, array()); |
378 | return $r; | |
e501603b TO |
379 | } |
380 | } |