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