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