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