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