Merge pull request #15784 from civicrm/5.20
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2020
6 *
7 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ba3d9fa454b710c09e18299d8531a9b2)
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 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 'where' => 'civicrm_price_field_value.name',
223 'table_name' => 'civicrm_price_field_value',
224 'entity' => 'PriceFieldValue',
225 'bao' => 'CRM_Price_BAO_PriceFieldValue',
226 'localizable' => 0,
227 'html' => [
228 'type' => 'Text',
229 ],
230 ],
231 'label' => [
232 'name' => 'label',
233 'type' => CRM_Utils_Type::T_STRING,
234 'title' => ts('Label'),
235 'description' => ts('Price field option label'),
236 'maxlength' => 255,
237 'size' => CRM_Utils_Type::HUGE,
238 'where' => 'civicrm_price_field_value.label',
239 'table_name' => 'civicrm_price_field_value',
240 'entity' => 'PriceFieldValue',
241 'bao' => 'CRM_Price_BAO_PriceFieldValue',
242 'localizable' => 1,
243 'html' => [
244 'type' => 'Text',
245 ],
246 ],
247 'description' => [
248 'name' => 'description',
249 'type' => CRM_Utils_Type::T_TEXT,
250 'title' => ts('Description'),
251 'description' => ts('Price field option description.'),
252 'rows' => 2,
253 'cols' => 60,
254 'where' => 'civicrm_price_field_value.description',
255 'default' => 'NULL',
256 'table_name' => 'civicrm_price_field_value',
257 'entity' => 'PriceFieldValue',
258 'bao' => 'CRM_Price_BAO_PriceFieldValue',
259 'localizable' => 1,
260 'html' => [
261 'type' => 'TextArea',
262 ],
263 ],
264 'help_pre' => [
265 'name' => 'help_pre',
266 'type' => CRM_Utils_Type::T_TEXT,
267 'title' => ts('Help Pre'),
268 'description' => ts('Price field option pre help text.'),
269 'rows' => 2,
270 'cols' => 60,
271 'where' => 'civicrm_price_field_value.help_pre',
272 'default' => 'NULL',
273 'table_name' => 'civicrm_price_field_value',
274 'entity' => 'PriceFieldValue',
275 'bao' => 'CRM_Price_BAO_PriceFieldValue',
276 'localizable' => 1,
277 'html' => [
278 'type' => 'TextArea',
279 ],
280 ],
281 'help_post' => [
282 'name' => 'help_post',
283 'type' => CRM_Utils_Type::T_TEXT,
284 'title' => ts('Help Post'),
285 'description' => ts('Price field option post field help.'),
286 'rows' => 2,
287 'cols' => 60,
288 'where' => 'civicrm_price_field_value.help_post',
289 'default' => 'NULL',
290 'table_name' => 'civicrm_price_field_value',
291 'entity' => 'PriceFieldValue',
292 'bao' => 'CRM_Price_BAO_PriceFieldValue',
293 'localizable' => 1,
294 'html' => [
295 'type' => 'TextArea',
296 ],
297 ],
298 'amount' => [
299 'name' => 'amount',
300 'type' => CRM_Utils_Type::T_MONEY,
301 'title' => ts('Amount'),
302 'description' => ts('Price field option amount'),
303 'required' => TRUE,
304 'precision' => [
305 18,
306 9,
307 ],
308 'where' => 'civicrm_price_field_value.amount',
309 'table_name' => 'civicrm_price_field_value',
310 'entity' => 'PriceFieldValue',
311 'bao' => 'CRM_Price_BAO_PriceFieldValue',
312 'localizable' => 0,
313 'html' => [
314 'type' => 'Text',
315 ],
316 ],
317 'count' => [
318 'name' => 'count',
319 'type' => CRM_Utils_Type::T_INT,
320 'title' => ts('Count'),
321 'description' => ts('Number of participants per field option'),
322 'where' => 'civicrm_price_field_value.count',
323 'default' => 'NULL',
324 'table_name' => 'civicrm_price_field_value',
325 'entity' => 'PriceFieldValue',
326 'bao' => 'CRM_Price_BAO_PriceFieldValue',
327 'localizable' => 0,
328 'html' => [
329 'type' => 'Text',
330 ],
331 ],
332 'max_value' => [
333 'name' => 'max_value',
334 'type' => CRM_Utils_Type::T_INT,
335 'title' => ts('Max Value'),
336 'description' => ts('Max number of participants per field options'),
337 'where' => 'civicrm_price_field_value.max_value',
338 'default' => 'NULL',
339 'table_name' => 'civicrm_price_field_value',
340 'entity' => 'PriceFieldValue',
341 'bao' => 'CRM_Price_BAO_PriceFieldValue',
342 'localizable' => 0,
343 'html' => [
344 'type' => 'Text',
345 ],
346 ],
347 'weight' => [
348 'name' => 'weight',
349 'type' => CRM_Utils_Type::T_INT,
350 'title' => ts('Order'),
351 'description' => ts('Order in which the field options should appear'),
352 'where' => 'civicrm_price_field_value.weight',
353 'default' => '1',
354 'table_name' => 'civicrm_price_field_value',
355 'entity' => 'PriceFieldValue',
356 'bao' => 'CRM_Price_BAO_PriceFieldValue',
357 'localizable' => 0,
358 'html' => [
359 'type' => 'Text',
360 ],
361 ],
362 'membership_type_id' => [
363 'name' => 'membership_type_id',
364 'type' => CRM_Utils_Type::T_INT,
365 'title' => ts('Membership Type'),
366 'description' => ts('FK to Membership Type'),
367 'where' => 'civicrm_price_field_value.membership_type_id',
368 'default' => 'NULL',
369 'table_name' => 'civicrm_price_field_value',
370 'entity' => 'PriceFieldValue',
371 'bao' => 'CRM_Price_BAO_PriceFieldValue',
372 'localizable' => 0,
373 'FKClassName' => 'CRM_Member_DAO_MembershipType',
374 'html' => [
375 'type' => 'Select',
376 ],
377 ],
378 'membership_num_terms' => [
379 'name' => 'membership_num_terms',
380 'type' => CRM_Utils_Type::T_INT,
381 'title' => ts('Membership Num Terms'),
382 'description' => ts('Number of terms for this membership'),
383 'where' => 'civicrm_price_field_value.membership_num_terms',
384 'default' => 'NULL',
385 'table_name' => 'civicrm_price_field_value',
386 'entity' => 'PriceFieldValue',
387 'bao' => 'CRM_Price_BAO_PriceFieldValue',
388 'localizable' => 0,
389 'html' => [
390 'type' => 'Text',
391 ],
392 ],
393 'is_default' => [
394 'name' => 'is_default',
395 'type' => CRM_Utils_Type::T_BOOLEAN,
396 'title' => ts('Is Default Price Field Option?'),
397 'description' => ts('Is this default price field option'),
398 'where' => 'civicrm_price_field_value.is_default',
399 'default' => '0',
400 'table_name' => 'civicrm_price_field_value',
401 'entity' => 'PriceFieldValue',
402 'bao' => 'CRM_Price_BAO_PriceFieldValue',
403 'localizable' => 0,
404 'html' => [
405 'type' => 'CheckBox',
406 ],
407 ],
408 'is_active' => [
409 'name' => 'is_active',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
411 'title' => ts('Price Field Value is Active'),
412 'description' => ts('Is this price field value active'),
413 'where' => 'civicrm_price_field_value.is_active',
414 'default' => '1',
415 'table_name' => 'civicrm_price_field_value',
416 'entity' => 'PriceFieldValue',
417 'bao' => 'CRM_Price_BAO_PriceFieldValue',
418 'localizable' => 0,
419 ],
420 'financial_type_id' => [
421 'name' => 'financial_type_id',
422 'type' => CRM_Utils_Type::T_INT,
423 'title' => ts('Financial Type'),
424 'description' => ts('FK to Financial Type.'),
425 'where' => 'civicrm_price_field_value.financial_type_id',
426 'default' => 'NULL',
427 'table_name' => 'civicrm_price_field_value',
428 'entity' => 'PriceFieldValue',
429 'bao' => 'CRM_Price_BAO_PriceFieldValue',
430 'localizable' => 0,
431 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
432 'html' => [
433 'type' => 'Select',
434 ],
435 'pseudoconstant' => [
436 'table' => 'civicrm_financial_type',
437 'keyColumn' => 'id',
438 'labelColumn' => 'name',
439 ],
440 ],
441 'non_deductible_amount' => [
442 'name' => 'non_deductible_amount',
443 'type' => CRM_Utils_Type::T_MONEY,
444 'title' => ts('Non-deductible Amount'),
445 'description' => ts('Portion of total amount which is NOT tax deductible.'),
446 'required' => TRUE,
447 'precision' => [
448 20,
449 2,
450 ],
451 'where' => 'civicrm_price_field_value.non_deductible_amount',
452 'headerPattern' => '/non?.?deduct/i',
453 'dataPattern' => '/^\d+(\.\d{2})?$/',
454 'default' => '0.0',
455 'table_name' => 'civicrm_price_field_value',
456 'entity' => 'PriceFieldValue',
457 'bao' => 'CRM_Price_BAO_PriceFieldValue',
458 'localizable' => 0,
459 'html' => [
460 'type' => 'Text',
461 ],
462 ],
463 'visibility_id' => [
464 'name' => 'visibility_id',
465 'type' => CRM_Utils_Type::T_INT,
466 'title' => ts('Price Field Option Visibility'),
467 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
468 'where' => 'civicrm_price_field_value.visibility_id',
469 'default' => '1',
470 'table_name' => 'civicrm_price_field_value',
471 'entity' => 'PriceFieldValue',
472 'bao' => 'CRM_Price_BAO_PriceFieldValue',
473 'localizable' => 0,
474 'html' => [
475 'type' => 'Select',
476 ],
477 'pseudoconstant' => [
478 'optionGroupName' => 'visibility',
479 'optionEditPath' => 'civicrm/admin/options/visibility',
480 ],
481 ],
482 ];
483 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
484 }
485 return Civi::$statics[__CLASS__]['fields'];
486 }
487
488 /**
489 * Return a mapping from field-name to the corresponding key (as used in fields()).
490 *
491 * @return array
492 * Array(string $name => string $uniqueName).
493 */
494 public static function &fieldKeys() {
495 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
496 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
497 }
498 return Civi::$statics[__CLASS__]['fieldKeys'];
499 }
500
501 /**
502 * Returns the names of this table
503 *
504 * @return string
505 */
506 public static function getTableName() {
507 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
508 }
509
510 /**
511 * Returns if this table needs to be logged
512 *
513 * @return bool
514 */
515 public function getLog() {
516 return self::$_log;
517 }
518
519 /**
520 * Returns the list of fields that can be imported
521 *
522 * @param bool $prefix
523 *
524 * @return array
525 */
526 public static function &import($prefix = FALSE) {
527 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, []);
528 return $r;
529 }
530
531 /**
532 * Returns the list of fields that can be exported
533 *
534 * @param bool $prefix
535 *
536 * @return array
537 */
538 public static function &export($prefix = FALSE) {
539 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, []);
540 return $r;
541 }
542
543 /**
544 * Returns the list of indices
545 *
546 * @param bool $localize
547 *
548 * @return array
549 */
550 public static function indices($localize = TRUE) {
551 $indices = [];
552 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
553 }
554
555 }