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