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