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