API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:7e0a818f8b8641ca3bae0abe1582c8ce)
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 localized title of this entity.
158 */
159 public static function getEntityTitle() {
160 return ts('Price Fields');
161 }
162
163 /**
164 * Returns foreign keys and entity references.
165 *
166 * @return array
167 * [CRM_Core_Reference_Interface]
168 */
169 public static function getReferenceColumns() {
170 if (!isset(Civi::$statics[__CLASS__]['links'])) {
171 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
172 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
173 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
174 }
175 return Civi::$statics[__CLASS__]['links'];
176 }
177
178 /**
179 * Returns all the column names of this table
180 *
181 * @return array
182 */
183 public static function &fields() {
184 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
185 Civi::$statics[__CLASS__]['fields'] = [
186 'id' => [
187 'name' => 'id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Price Field ID'),
190 'description' => ts('Price Field'),
191 'required' => TRUE,
192 'where' => 'civicrm_price_field.id',
193 'table_name' => 'civicrm_price_field',
194 'entity' => 'PriceField',
195 'bao' => 'CRM_Price_BAO_PriceField',
196 'localizable' => 0,
197 'add' => '1.8',
198 ],
199 'price_set_id' => [
200 'name' => 'price_set_id',
201 'type' => CRM_Utils_Type::T_INT,
202 'title' => ts('Price Set'),
203 'description' => ts('FK to civicrm_price_set'),
204 'required' => TRUE,
205 'where' => 'civicrm_price_field.price_set_id',
206 'table_name' => 'civicrm_price_field',
207 'entity' => 'PriceField',
208 'bao' => 'CRM_Price_BAO_PriceField',
209 'localizable' => 0,
210 'FKClassName' => 'CRM_Price_DAO_PriceSet',
211 'pseudoconstant' => [
212 'table' => 'civicrm_price_set',
213 'keyColumn' => 'id',
214 'labelColumn' => 'title',
215 'nameColumn' => 'name',
216 ],
217 'add' => '1.8',
218 ],
219 'name' => [
220 'name' => 'name',
221 'type' => CRM_Utils_Type::T_STRING,
222 'title' => ts('Name'),
223 'description' => ts('Variable name/programmatic handle for this field.'),
224 'required' => TRUE,
225 'maxlength' => 255,
226 'size' => CRM_Utils_Type::HUGE,
227 'where' => 'civicrm_price_field.name',
228 'table_name' => 'civicrm_price_field',
229 'entity' => 'PriceField',
230 'bao' => 'CRM_Price_BAO_PriceField',
231 'localizable' => 0,
232 'html' => [
233 'type' => 'Text',
234 ],
235 'add' => '1.8',
236 ],
237 'label' => [
238 'name' => 'label',
239 'type' => CRM_Utils_Type::T_STRING,
240 'title' => ts('Label'),
241 'description' => ts('Text for form field label (also friendly name for administering this field).'),
242 'required' => TRUE,
243 'maxlength' => 255,
244 'size' => CRM_Utils_Type::HUGE,
245 'where' => 'civicrm_price_field.label',
246 'table_name' => 'civicrm_price_field',
247 'entity' => 'PriceField',
248 'bao' => 'CRM_Price_BAO_PriceField',
249 'localizable' => 1,
250 'html' => [
251 'type' => 'Text',
252 ],
253 'add' => '1.8',
254 ],
255 'html_type' => [
256 'name' => 'html_type',
257 'type' => CRM_Utils_Type::T_STRING,
258 'title' => ts('Html Type'),
259 'required' => TRUE,
260 'maxlength' => 12,
261 'size' => CRM_Utils_Type::TWELVE,
262 'where' => 'civicrm_price_field.html_type',
263 'table_name' => 'civicrm_price_field',
264 'entity' => 'PriceField',
265 'bao' => 'CRM_Price_BAO_PriceField',
266 'localizable' => 0,
267 'html' => [
268 'type' => 'Select',
269 ],
270 'pseudoconstant' => [
271 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
272 ],
273 'add' => '1.8',
274 ],
275 'is_enter_qty' => [
276 'name' => 'is_enter_qty',
277 'type' => CRM_Utils_Type::T_BOOLEAN,
278 'title' => ts('Price Field Quantity Required?'),
279 'description' => ts('Enter a quantity for this field?'),
280 'where' => 'civicrm_price_field.is_enter_qty',
281 'default' => '0',
282 'table_name' => 'civicrm_price_field',
283 'entity' => 'PriceField',
284 'bao' => 'CRM_Price_BAO_PriceField',
285 'localizable' => 0,
286 'html' => [
287 'type' => 'CheckBox',
288 ],
289 'add' => '1.8',
290 ],
291 'help_pre' => [
292 'name' => 'help_pre',
293 'type' => CRM_Utils_Type::T_TEXT,
294 'title' => ts('Price Field Pre Text'),
295 'description' => ts('Description and/or help text to display before this field.'),
296 'rows' => 4,
297 'cols' => 80,
298 'where' => 'civicrm_price_field.help_pre',
299 'table_name' => 'civicrm_price_field',
300 'entity' => 'PriceField',
301 'bao' => 'CRM_Price_BAO_PriceField',
302 'localizable' => 1,
303 'html' => [
304 'type' => 'TextArea',
305 ],
306 'add' => '1.8',
307 ],
308 'help_post' => [
309 'name' => 'help_post',
310 'type' => CRM_Utils_Type::T_TEXT,
311 'title' => ts('Price Field Post Text'),
312 'description' => ts('Description and/or help text to display after this field.'),
313 'rows' => 4,
314 'cols' => 80,
315 'where' => 'civicrm_price_field.help_post',
316 'table_name' => 'civicrm_price_field',
317 'entity' => 'PriceField',
318 'bao' => 'CRM_Price_BAO_PriceField',
319 'localizable' => 1,
320 'html' => [
321 'type' => 'TextArea',
322 ],
323 'add' => '1.8',
324 ],
325 'weight' => [
326 'name' => 'weight',
327 'type' => CRM_Utils_Type::T_INT,
328 'title' => ts('Order'),
329 'description' => ts('Order in which the fields should appear'),
330 'where' => 'civicrm_price_field.weight',
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' => 'Select',
338 ],
339 'add' => '1.8',
340 ],
341 'is_display_amounts' => [
342 'name' => 'is_display_amounts',
343 'type' => CRM_Utils_Type::T_BOOLEAN,
344 'title' => ts('Price Field Show Amounts?'),
345 'description' => ts('Should the price be displayed next to the label for each option?'),
346 'where' => 'civicrm_price_field.is_display_amounts',
347 'default' => '1',
348 'table_name' => 'civicrm_price_field',
349 'entity' => 'PriceField',
350 'bao' => 'CRM_Price_BAO_PriceField',
351 'localizable' => 0,
352 'html' => [
353 'type' => 'CheckBox',
354 ],
355 'add' => NULL,
356 ],
357 'options_per_line' => [
358 'name' => 'options_per_line',
359 'type' => CRM_Utils_Type::T_INT,
360 'title' => ts('Price Field Options per Row'),
361 'description' => ts('number of options per line for checkbox and radio'),
362 'where' => 'civicrm_price_field.options_per_line',
363 'default' => '1',
364 'table_name' => 'civicrm_price_field',
365 'entity' => 'PriceField',
366 'bao' => 'CRM_Price_BAO_PriceField',
367 'localizable' => 0,
368 'html' => [
369 'type' => 'Text',
370 ],
371 'add' => '1.8',
372 ],
373 'is_active' => [
374 'name' => 'is_active',
375 'type' => CRM_Utils_Type::T_BOOLEAN,
376 'title' => ts('Price Field Is Active?'),
377 'description' => ts('Is this price field active'),
378 'where' => 'civicrm_price_field.is_active',
379 'default' => '1',
380 'table_name' => 'civicrm_price_field',
381 'entity' => 'PriceField',
382 'bao' => 'CRM_Price_BAO_PriceField',
383 'localizable' => 0,
384 'html' => [
385 'type' => 'CheckBox',
386 ],
387 'add' => '1.8',
388 ],
389 'is_required' => [
390 'name' => 'is_required',
391 'type' => CRM_Utils_Type::T_BOOLEAN,
392 'title' => ts('Price Field is Required?'),
393 'description' => ts('Is this price field required (value must be > 1)'),
394 'where' => 'civicrm_price_field.is_required',
395 'default' => '1',
396 'table_name' => 'civicrm_price_field',
397 'entity' => 'PriceField',
398 'bao' => 'CRM_Price_BAO_PriceField',
399 'localizable' => 0,
400 'html' => [
401 'type' => 'CheckBox',
402 ],
403 'add' => '1.8',
404 ],
405 'active_on' => [
406 'name' => 'active_on',
407 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
408 'title' => ts('Price Field Start Date'),
409 'description' => ts('If non-zero, do not show this field before the date specified'),
410 'where' => 'civicrm_price_field.active_on',
411 'default' => 'NULL',
412 'table_name' => 'civicrm_price_field',
413 'entity' => 'PriceField',
414 'bao' => 'CRM_Price_BAO_PriceField',
415 'localizable' => 0,
416 'html' => [
417 'type' => 'Select Date',
418 'formatType' => 'activityDateTime',
419 ],
420 'add' => '1.8',
421 ],
422 'expire_on' => [
423 'name' => 'expire_on',
424 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
425 'title' => ts('Price Field End Date'),
426 'description' => ts('If non-zero, do not show this field after the date specified'),
427 'where' => 'civicrm_price_field.expire_on',
428 'default' => 'NULL',
429 'table_name' => 'civicrm_price_field',
430 'entity' => 'PriceField',
431 'bao' => 'CRM_Price_BAO_PriceField',
432 'localizable' => 0,
433 'html' => [
434 'type' => 'Select Date',
435 'formatType' => 'activityDateTime',
436 ],
437 'add' => '1.8',
438 ],
439 'javascript' => [
440 'name' => 'javascript',
441 'type' => CRM_Utils_Type::T_STRING,
442 'title' => ts('Price Field Javascript'),
443 'description' => ts('Optional scripting attributes for field'),
444 'maxlength' => 255,
445 'size' => CRM_Utils_Type::HUGE,
446 'where' => 'civicrm_price_field.javascript',
447 'table_name' => 'civicrm_price_field',
448 'entity' => 'PriceField',
449 'bao' => 'CRM_Price_BAO_PriceField',
450 'localizable' => 0,
451 'html' => [
452 'type' => 'Text',
453 ],
454 'add' => '1.8',
455 ],
456 'visibility_id' => [
457 'name' => 'visibility_id',
458 'type' => CRM_Utils_Type::T_INT,
459 'title' => ts('Price Field Visibility'),
460 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
461 'where' => 'civicrm_price_field.visibility_id',
462 'default' => '1',
463 'table_name' => 'civicrm_price_field',
464 'entity' => 'PriceField',
465 'bao' => 'CRM_Price_BAO_PriceField',
466 'localizable' => 0,
467 'html' => [
468 'type' => 'Select',
469 ],
470 'pseudoconstant' => [
471 'optionGroupName' => 'visibility',
472 'optionEditPath' => 'civicrm/admin/options/visibility',
473 ],
474 'add' => '3.2',
475 ],
476 ];
477 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
478 }
479 return Civi::$statics[__CLASS__]['fields'];
480 }
481
482 /**
483 * Return a mapping from field-name to the corresponding key (as used in fields()).
484 *
485 * @return array
486 * Array(string $name => string $uniqueName).
487 */
488 public static function &fieldKeys() {
489 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
490 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
491 }
492 return Civi::$statics[__CLASS__]['fieldKeys'];
493 }
494
495 /**
496 * Returns the names of this table
497 *
498 * @return string
499 */
500 public static function getTableName() {
501 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
502 }
503
504 /**
505 * Returns if this table needs to be logged
506 *
507 * @return bool
508 */
509 public function getLog() {
510 return self::$_log;
511 }
512
513 /**
514 * Returns the list of fields that can be imported
515 *
516 * @param bool $prefix
517 *
518 * @return array
519 */
520 public static function &import($prefix = FALSE) {
521 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field', $prefix, []);
522 return $r;
523 }
524
525 /**
526 * Returns the list of fields that can be exported
527 *
528 * @param bool $prefix
529 *
530 * @return array
531 */
532 public static function &export($prefix = FALSE) {
533 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field', $prefix, []);
534 return $r;
535 }
536
537 /**
538 * Returns the list of indices
539 *
540 * @param bool $localize
541 *
542 * @return array
543 */
544 public static function indices($localize = TRUE) {
545 $indices = [
546 'index_name' => [
547 'name' => 'index_name',
548 'field' => [
549 0 => 'name',
550 ],
551 'localizable' => FALSE,
552 'sig' => 'civicrm_price_field::0::name',
553 ],
554 ];
555 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
556 }
557
558 }