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