ce202a3a40bd8b25b9d6fe317124ce74ac633306
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:44b920e4a8091f16a96990834a24c288)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Price_DAO_PriceFieldValue constructor.
39 */
40 class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_price_field_value';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Price Field Value
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * FK to civicrm_price_field
61 *
62 * @var int unsigned
63 */
64 public $price_field_id;
65 /**
66 * Price field option name
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * Price field option label
73 *
74 * @var string
75 */
76 public $label;
77 /**
78 * >Price field option description.
79 *
80 * @var text
81 */
82 public $description;
83 /**
84 * Price field option pre help text.
85 *
86 * @var text
87 */
88 public $help_pre;
89 /**
90 * Price field option post field help.
91 *
92 * @var text
93 */
94 public $help_post;
95 /**
96 * Price field option amount
97 *
98 * @var string
99 */
100 public $amount;
101 /**
102 * Number of participants per field option
103 *
104 * @var int unsigned
105 */
106 public $count;
107 /**
108 * Max number of participants per field options
109 *
110 * @var int unsigned
111 */
112 public $max_value;
113 /**
114 * Order in which the field options should appear
115 *
116 * @var int
117 */
118 public $weight;
119 /**
120 * FK to Membership Type
121 *
122 * @var int unsigned
123 */
124 public $membership_type_id;
125 /**
126 * Number of terms for this membership
127 *
128 * @var int unsigned
129 */
130 public $membership_num_terms;
131 /**
132 * Is this default price field option
133 *
134 * @var boolean
135 */
136 public $is_default;
137 /**
138 * Is this price field value active
139 *
140 * @var boolean
141 */
142 public $is_active;
143 /**
144 * FK to Financial Type.
145 *
146 * @var int unsigned
147 */
148 public $financial_type_id;
149 /**
150 * Portion of total amount which is NOT tax deductible.
151 *
152 * @var float
153 */
154 public $non_deductible_amount;
155 /**
156 * Class constructor.
157 */
158 function __construct() {
159 $this->__table = 'civicrm_price_field_value';
160 parent::__construct();
161 }
162 /**
163 * Returns foreign keys and entity references.
164 *
165 * @return array
166 * [CRM_Core_Reference_Interface]
167 */
168 static function getReferenceColumns() {
169 if (!isset(Civi::$statics[__CLASS__]['links'])) {
170 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
171 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
172 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
173 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
174 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
175 }
176 return Civi::$statics[__CLASS__]['links'];
177 }
178 /**
179 * Returns all the column names of this table
180 *
181 * @return array
182 */
183 static function &fields() {
184 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
185 Civi::$statics[__CLASS__]['fields'] = array(
186 'id' => array(
187 'name' => 'id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Price Field Value ID') ,
190 'description' => 'Price Field Value',
191 'required' => true,
192 'table_name' => 'civicrm_price_field_value',
193 'entity' => 'PriceFieldValue',
194 'bao' => 'CRM_Price_BAO_PriceFieldValue',
195 'localizable' => 0,
196 ) ,
197 'price_field_id' => array(
198 'name' => 'price_field_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Price Field') ,
201 'description' => 'FK to civicrm_price_field',
202 'required' => true,
203 'table_name' => 'civicrm_price_field_value',
204 'entity' => 'PriceFieldValue',
205 'bao' => 'CRM_Price_BAO_PriceFieldValue',
206 'localizable' => 0,
207 'FKClassName' => 'CRM_Price_DAO_PriceField',
208 ) ,
209 'name' => array(
210 'name' => 'name',
211 'type' => CRM_Utils_Type::T_STRING,
212 'title' => ts('Name') ,
213 'description' => 'Price field option name',
214 'maxlength' => 255,
215 'size' => CRM_Utils_Type::HUGE,
216 'table_name' => 'civicrm_price_field_value',
217 'entity' => 'PriceFieldValue',
218 'bao' => 'CRM_Price_BAO_PriceFieldValue',
219 'localizable' => 0,
220 'html' => array(
221 'type' => 'Text',
222 ) ,
223 ) ,
224 'label' => array(
225 'name' => 'label',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Label') ,
228 'description' => 'Price field option label',
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
231 'table_name' => 'civicrm_price_field_value',
232 'entity' => 'PriceFieldValue',
233 'bao' => 'CRM_Price_BAO_PriceFieldValue',
234 'localizable' => 1,
235 'html' => array(
236 'type' => 'Text',
237 ) ,
238 ) ,
239 'description' => array(
240 'name' => 'description',
241 'type' => CRM_Utils_Type::T_TEXT,
242 'title' => ts('Description') ,
243 'description' => '>Price field option description.',
244 'rows' => 2,
245 'cols' => 60,
246 'default' => 'NULL',
247 'table_name' => 'civicrm_price_field_value',
248 'entity' => 'PriceFieldValue',
249 'bao' => 'CRM_Price_BAO_PriceFieldValue',
250 'localizable' => 1,
251 'html' => array(
252 'type' => 'TextArea',
253 ) ,
254 ) ,
255 'help_pre' => array(
256 'name' => 'help_pre',
257 'type' => CRM_Utils_Type::T_TEXT,
258 'title' => ts('Help Pre') ,
259 'description' => 'Price field option pre help text.',
260 'rows' => 2,
261 'cols' => 60,
262 'default' => 'NULL',
263 'table_name' => 'civicrm_price_field_value',
264 'entity' => 'PriceFieldValue',
265 'bao' => 'CRM_Price_BAO_PriceFieldValue',
266 'localizable' => 1,
267 'html' => array(
268 'type' => 'TextArea',
269 ) ,
270 ) ,
271 'help_post' => array(
272 'name' => 'help_post',
273 'type' => CRM_Utils_Type::T_TEXT,
274 'title' => ts('Help Post') ,
275 'description' => 'Price field option post field help.',
276 'rows' => 2,
277 'cols' => 60,
278 'default' => 'NULL',
279 'table_name' => 'civicrm_price_field_value',
280 'entity' => 'PriceFieldValue',
281 'bao' => 'CRM_Price_BAO_PriceFieldValue',
282 'localizable' => 1,
283 'html' => array(
284 'type' => 'TextArea',
285 ) ,
286 ) ,
287 'amount' => array(
288 'name' => 'amount',
289 'type' => CRM_Utils_Type::T_STRING,
290 'title' => ts('Amount') ,
291 'description' => 'Price field option amount',
292 'required' => true,
293 'maxlength' => 512,
294 'size' => 8,
295 'table_name' => 'civicrm_price_field_value',
296 'entity' => 'PriceFieldValue',
297 'bao' => 'CRM_Price_BAO_PriceFieldValue',
298 'localizable' => 0,
299 'html' => array(
300 'type' => 'Text',
301 ) ,
302 ) ,
303 'count' => array(
304 'name' => 'count',
305 'type' => CRM_Utils_Type::T_INT,
306 'title' => ts('Count') ,
307 'description' => 'Number of participants per field option',
308 'default' => 'NULL',
309 'table_name' => 'civicrm_price_field_value',
310 'entity' => 'PriceFieldValue',
311 'bao' => 'CRM_Price_BAO_PriceFieldValue',
312 'localizable' => 0,
313 'html' => array(
314 'type' => 'Text',
315 ) ,
316 ) ,
317 'max_value' => array(
318 'name' => 'max_value',
319 'type' => CRM_Utils_Type::T_INT,
320 'title' => ts('Max Value') ,
321 'description' => 'Max number of participants per field options',
322 'default' => 'NULL',
323 'table_name' => 'civicrm_price_field_value',
324 'entity' => 'PriceFieldValue',
325 'bao' => 'CRM_Price_BAO_PriceFieldValue',
326 'localizable' => 0,
327 'html' => array(
328 'type' => 'Text',
329 ) ,
330 ) ,
331 'weight' => array(
332 'name' => 'weight',
333 'type' => CRM_Utils_Type::T_INT,
334 'title' => ts('Order') ,
335 'description' => 'Order in which the field options should appear',
336 'default' => '1',
337 'table_name' => 'civicrm_price_field_value',
338 'entity' => 'PriceFieldValue',
339 'bao' => 'CRM_Price_BAO_PriceFieldValue',
340 'localizable' => 0,
341 'html' => array(
342 'type' => 'Text',
343 ) ,
344 ) ,
345 'membership_type_id' => array(
346 'name' => 'membership_type_id',
347 'type' => CRM_Utils_Type::T_INT,
348 'title' => ts('Membership Type') ,
349 'description' => 'FK to Membership Type',
350 'default' => 'NULL',
351 'table_name' => 'civicrm_price_field_value',
352 'entity' => 'PriceFieldValue',
353 'bao' => 'CRM_Price_BAO_PriceFieldValue',
354 'localizable' => 0,
355 'FKClassName' => 'CRM_Member_DAO_MembershipType',
356 'html' => array(
357 'type' => 'Select',
358 ) ,
359 ) ,
360 'membership_num_terms' => array(
361 'name' => 'membership_num_terms',
362 'type' => CRM_Utils_Type::T_INT,
363 'title' => ts('Membership Num Terms') ,
364 'description' => 'Number of terms for this membership',
365 'default' => 'NULL',
366 'table_name' => 'civicrm_price_field_value',
367 'entity' => 'PriceFieldValue',
368 'bao' => 'CRM_Price_BAO_PriceFieldValue',
369 'localizable' => 0,
370 'html' => array(
371 'type' => 'Text',
372 ) ,
373 ) ,
374 'is_default' => array(
375 'name' => 'is_default',
376 'type' => CRM_Utils_Type::T_BOOLEAN,
377 'title' => ts('Is Default Price Field Option?') ,
378 'description' => 'Is this default price field option',
379 'table_name' => 'civicrm_price_field_value',
380 'entity' => 'PriceFieldValue',
381 'bao' => 'CRM_Price_BAO_PriceFieldValue',
382 'localizable' => 0,
383 'html' => array(
384 'type' => 'CheckBox',
385 ) ,
386 ) ,
387 'is_active' => array(
388 'name' => 'is_active',
389 'type' => CRM_Utils_Type::T_BOOLEAN,
390 'title' => ts('Price Field Value is Active') ,
391 'description' => 'Is this price field value active',
392 'default' => '1',
393 'table_name' => 'civicrm_price_field_value',
394 'entity' => 'PriceFieldValue',
395 'bao' => 'CRM_Price_BAO_PriceFieldValue',
396 'localizable' => 0,
397 ) ,
398 'financial_type_id' => array(
399 'name' => 'financial_type_id',
400 'type' => CRM_Utils_Type::T_INT,
401 'title' => ts('Financial Type') ,
402 'description' => 'FK to Financial Type.',
403 'default' => 'NULL',
404 'table_name' => 'civicrm_price_field_value',
405 'entity' => 'PriceFieldValue',
406 'bao' => 'CRM_Price_BAO_PriceFieldValue',
407 'localizable' => 0,
408 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
409 'html' => array(
410 'type' => 'Select',
411 ) ,
412 'pseudoconstant' => array(
413 'table' => 'civicrm_financial_type',
414 'keyColumn' => 'id',
415 'labelColumn' => 'name',
416 )
417 ) ,
418 'non_deductible_amount' => array(
419 'name' => 'non_deductible_amount',
420 'type' => CRM_Utils_Type::T_MONEY,
421 'title' => ts('Non-deductible Amount') ,
422 'description' => 'Portion of total amount which is NOT tax deductible.',
423 'required' => true,
424 'precision' => array(
425 20,
426 2
427 ) ,
428 'default' => '0.0',
429 'table_name' => 'civicrm_price_field_value',
430 'entity' => 'PriceFieldValue',
431 'bao' => 'CRM_Price_BAO_PriceFieldValue',
432 'localizable' => 0,
433 'html' => array(
434 'type' => 'Text',
435 ) ,
436 ) ,
437 );
438 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
439 }
440 return Civi::$statics[__CLASS__]['fields'];
441 }
442 /**
443 * Return a mapping from field-name to the corresponding key (as used in fields()).
444 *
445 * @return array
446 * Array(string $name => string $uniqueName).
447 */
448 static function &fieldKeys() {
449 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
450 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
451 }
452 return Civi::$statics[__CLASS__]['fieldKeys'];
453 }
454 /**
455 * Returns the names of this table
456 *
457 * @return string
458 */
459 static function getTableName() {
460 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
461 }
462 /**
463 * Returns if this table needs to be logged
464 *
465 * @return boolean
466 */
467 function getLog() {
468 return self::$_log;
469 }
470 /**
471 * Returns the list of fields that can be imported
472 *
473 * @param bool $prefix
474 *
475 * @return array
476 */
477 static function &import($prefix = false) {
478 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array());
479 return $r;
480 }
481 /**
482 * Returns the list of fields that can be exported
483 *
484 * @param bool $prefix
485 *
486 * @return array
487 */
488 static function &export($prefix = false) {
489 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array());
490 return $r;
491 }
492 }