Merge pull request #14862 from mlutfy/event9
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.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/PriceFieldValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
74db51d3 9 * (GenCodeChecksum:ba3d9fa454b710c09e18299d8531a9b2)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PriceFieldValue entity.
f41f0342 14 */
e501603b 15class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_price_field_value';
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 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Price Field Value
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * FK to civicrm_price_field
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $price_field_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Price field option name
47 *
48 * @var string
49 */
50 public $name;
c3fc2621 51
e501603b
TO
52 /**
53 * Price field option label
54 *
55 * @var string
56 */
57 public $label;
c3fc2621 58
e501603b 59 /**
f95ab9d4 60 * Price field option description.
e501603b
TO
61 *
62 * @var text
63 */
64 public $description;
c3fc2621 65
e501603b
TO
66 /**
67 * Price field option pre help text.
68 *
69 * @var text
70 */
71 public $help_pre;
c3fc2621 72
e501603b
TO
73 /**
74 * Price field option post field help.
75 *
76 * @var text
77 */
78 public $help_post;
c3fc2621 79
e501603b
TO
80 /**
81 * Price field option amount
82 *
25e0f950 83 * @var float
e501603b
TO
84 */
85 public $amount;
c3fc2621 86
e501603b
TO
87 /**
88 * Number of participants per field option
89 *
e6ca0a57 90 * @var int
e501603b
TO
91 */
92 public $count;
c3fc2621 93
e501603b
TO
94 /**
95 * Max number of participants per field options
96 *
e6ca0a57 97 * @var int
e501603b
TO
98 */
99 public $max_value;
c3fc2621 100
e501603b
TO
101 /**
102 * Order in which the field options should appear
103 *
104 * @var int
105 */
106 public $weight;
c3fc2621 107
e501603b
TO
108 /**
109 * FK to Membership Type
110 *
e6ca0a57 111 * @var int
e501603b
TO
112 */
113 public $membership_type_id;
c3fc2621 114
e501603b
TO
115 /**
116 * Number of terms for this membership
117 *
e6ca0a57 118 * @var int
e501603b
TO
119 */
120 public $membership_num_terms;
c3fc2621 121
e501603b
TO
122 /**
123 * Is this default price field option
124 *
e6ca0a57 125 * @var bool
e501603b
TO
126 */
127 public $is_default;
c3fc2621 128
e501603b
TO
129 /**
130 * Is this price field value active
131 *
e6ca0a57 132 * @var bool
e501603b
TO
133 */
134 public $is_active;
c3fc2621 135
e501603b
TO
136 /**
137 * FK to Financial Type.
138 *
e6ca0a57 139 * @var int
e501603b
TO
140 */
141 public $financial_type_id;
c3fc2621 142
e501603b 143 /**
5afce5ad 144 * Portion of total amount which is NOT tax deductible.
e501603b
TO
145 *
146 * @var float
147 */
5afce5ad 148 public $non_deductible_amount;
c3fc2621 149
2db35bf6 150 /**
64ca7bcd 151 * Implicit FK to civicrm_option_group with name = 'visibility'
2db35bf6 152 *
e6ca0a57 153 * @var int
2db35bf6
AF
154 */
155 public $visibility_id;
c3fc2621 156
e501603b 157 /**
f41f0342 158 * Class constructor.
e501603b 159 */
c3fc2621 160 public function __construct() {
e501603b
TO
161 $this->__table = 'civicrm_price_field_value';
162 parent::__construct();
163 }
c3fc2621 164
e501603b 165 /**
f41f0342 166 * Returns foreign keys and entity references.
e501603b
TO
167 *
168 * @return array
169 * [CRM_Core_Reference_Interface]
170 */
c3fc2621 171 public static function getReferenceColumns() {
346aaaba 172 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 173 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
174 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_id', 'civicrm_price_field', 'id');
175 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
176 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
346aaaba 177 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 178 }
346aaaba 179 return Civi::$statics[__CLASS__]['links'];
e501603b 180 }
c3fc2621 181
e501603b
TO
182 /**
183 * Returns all the column names of this table
184 *
185 * @return array
186 */
c3fc2621 187 public static function &fields() {
346aaaba 188 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
189 Civi::$statics[__CLASS__]['fields'] = [
190 'id' => [
e501603b
TO
191 'name' => 'id',
192 'type' => CRM_Utils_Type::T_INT,
c3fc2621 193 'title' => ts('Price Field Value ID'),
215b423e 194 'description' => ts('Price Field Value'),
c3fc2621 195 'required' => TRUE,
a36434b9 196 'where' => 'civicrm_price_field_value.id',
522a26c9 197 'table_name' => 'civicrm_price_field_value',
198 'entity' => 'PriceFieldValue',
199 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 200 'localizable' => 0,
c3fc2621
CW
201 ],
202 'price_field_id' => [
e501603b
TO
203 'name' => 'price_field_id',
204 'type' => CRM_Utils_Type::T_INT,
c3fc2621 205 'title' => ts('Price Field'),
215b423e 206 'description' => ts('FK to civicrm_price_field'),
c3fc2621 207 'required' => TRUE,
a36434b9 208 'where' => 'civicrm_price_field_value.price_field_id',
522a26c9 209 'table_name' => 'civicrm_price_field_value',
210 'entity' => 'PriceFieldValue',
211 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 212 'localizable' => 0,
e501603b 213 'FKClassName' => 'CRM_Price_DAO_PriceField',
c3fc2621
CW
214 ],
215 'name' => [
e501603b
TO
216 'name' => 'name',
217 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 218 'title' => ts('Name'),
215b423e 219 'description' => ts('Price field option name'),
e501603b
TO
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
a36434b9 222 'where' => 'civicrm_price_field_value.name',
522a26c9 223 'table_name' => 'civicrm_price_field_value',
224 'entity' => 'PriceFieldValue',
225 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 226 'localizable' => 0,
c3fc2621 227 'html' => [
e501603b 228 'type' => 'Text',
c3fc2621
CW
229 ],
230 ],
231 'label' => [
e501603b
TO
232 'name' => 'label',
233 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 234 'title' => ts('Label'),
215b423e 235 'description' => ts('Price field option label'),
e501603b
TO
236 'maxlength' => 255,
237 'size' => CRM_Utils_Type::HUGE,
a36434b9 238 'where' => 'civicrm_price_field_value.label',
522a26c9 239 'table_name' => 'civicrm_price_field_value',
240 'entity' => 'PriceFieldValue',
241 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 242 'localizable' => 1,
c3fc2621 243 'html' => [
e501603b 244 'type' => 'Text',
c3fc2621
CW
245 ],
246 ],
247 'description' => [
e501603b
TO
248 'name' => 'description',
249 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 250 'title' => ts('Description'),
f95ab9d4 251 'description' => ts('Price field option description.'),
e501603b
TO
252 'rows' => 2,
253 'cols' => 60,
a36434b9 254 'where' => 'civicrm_price_field_value.description',
e501603b 255 'default' => 'NULL',
522a26c9 256 'table_name' => 'civicrm_price_field_value',
257 'entity' => 'PriceFieldValue',
258 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 259 'localizable' => 1,
c3fc2621 260 'html' => [
e501603b 261 'type' => 'TextArea',
c3fc2621
CW
262 ],
263 ],
264 'help_pre' => [
e501603b
TO
265 'name' => 'help_pre',
266 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 267 'title' => ts('Help Pre'),
215b423e 268 'description' => ts('Price field option pre help text.'),
e501603b
TO
269 'rows' => 2,
270 'cols' => 60,
a36434b9 271 'where' => 'civicrm_price_field_value.help_pre',
e501603b 272 'default' => 'NULL',
522a26c9 273 'table_name' => 'civicrm_price_field_value',
274 'entity' => 'PriceFieldValue',
275 'bao' => 'CRM_Price_BAO_PriceFieldValue',
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('Help Post'),
215b423e 285 'description' => ts('Price field option post field help.'),
e501603b
TO
286 'rows' => 2,
287 'cols' => 60,
a36434b9 288 'where' => 'civicrm_price_field_value.help_post',
e501603b 289 'default' => 'NULL',
522a26c9 290 'table_name' => 'civicrm_price_field_value',
291 'entity' => 'PriceFieldValue',
292 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 293 'localizable' => 1,
c3fc2621 294 'html' => [
e501603b 295 'type' => 'TextArea',
c3fc2621
CW
296 ],
297 ],
298 'amount' => [
e501603b 299 'name' => 'amount',
25e0f950 300 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 301 'title' => ts('Amount'),
215b423e 302 'description' => ts('Price field option amount'),
c3fc2621
CW
303 'required' => TRUE,
304 'precision' => [
25e0f950 305 18,
fb607354 306 9,
c3fc2621 307 ],
a36434b9 308 'where' => 'civicrm_price_field_value.amount',
522a26c9 309 'table_name' => 'civicrm_price_field_value',
310 'entity' => 'PriceFieldValue',
311 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 312 'localizable' => 0,
c3fc2621 313 'html' => [
e501603b 314 'type' => 'Text',
c3fc2621
CW
315 ],
316 ],
317 'count' => [
e501603b
TO
318 'name' => 'count',
319 'type' => CRM_Utils_Type::T_INT,
c3fc2621 320 'title' => ts('Count'),
215b423e 321 'description' => ts('Number of participants per field option'),
a36434b9 322 'where' => 'civicrm_price_field_value.count',
e501603b 323 'default' => 'NULL',
522a26c9 324 'table_name' => 'civicrm_price_field_value',
325 'entity' => 'PriceFieldValue',
326 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 327 'localizable' => 0,
c3fc2621 328 'html' => [
e501603b 329 'type' => 'Text',
c3fc2621
CW
330 ],
331 ],
332 'max_value' => [
e501603b
TO
333 'name' => 'max_value',
334 'type' => CRM_Utils_Type::T_INT,
c3fc2621 335 'title' => ts('Max Value'),
215b423e 336 'description' => ts('Max number of participants per field options'),
a36434b9 337 'where' => 'civicrm_price_field_value.max_value',
e501603b 338 'default' => 'NULL',
522a26c9 339 'table_name' => 'civicrm_price_field_value',
340 'entity' => 'PriceFieldValue',
341 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 342 'localizable' => 0,
c3fc2621 343 'html' => [
e501603b 344 'type' => 'Text',
c3fc2621
CW
345 ],
346 ],
347 'weight' => [
e501603b
TO
348 'name' => 'weight',
349 'type' => CRM_Utils_Type::T_INT,
c3fc2621 350 'title' => ts('Order'),
215b423e 351 'description' => ts('Order in which the field options should appear'),
a36434b9 352 'where' => 'civicrm_price_field_value.weight',
e501603b 353 'default' => '1',
522a26c9 354 'table_name' => 'civicrm_price_field_value',
355 'entity' => 'PriceFieldValue',
356 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 357 'localizable' => 0,
c3fc2621 358 'html' => [
e501603b 359 'type' => 'Text',
c3fc2621
CW
360 ],
361 ],
362 'membership_type_id' => [
e501603b
TO
363 'name' => 'membership_type_id',
364 'type' => CRM_Utils_Type::T_INT,
c3fc2621 365 'title' => ts('Membership Type'),
215b423e 366 'description' => ts('FK to Membership Type'),
a36434b9 367 'where' => 'civicrm_price_field_value.membership_type_id',
e501603b 368 'default' => 'NULL',
522a26c9 369 'table_name' => 'civicrm_price_field_value',
370 'entity' => 'PriceFieldValue',
371 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 372 'localizable' => 0,
e501603b 373 'FKClassName' => 'CRM_Member_DAO_MembershipType',
c3fc2621 374 'html' => [
e501603b 375 'type' => 'Select',
c3fc2621
CW
376 ],
377 ],
378 'membership_num_terms' => [
e501603b
TO
379 'name' => 'membership_num_terms',
380 'type' => CRM_Utils_Type::T_INT,
c3fc2621 381 'title' => ts('Membership Num Terms'),
215b423e 382 'description' => ts('Number of terms for this membership'),
a36434b9 383 'where' => 'civicrm_price_field_value.membership_num_terms',
e501603b 384 'default' => 'NULL',
522a26c9 385 'table_name' => 'civicrm_price_field_value',
386 'entity' => 'PriceFieldValue',
387 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 388 'localizable' => 0,
c3fc2621 389 'html' => [
e501603b 390 'type' => 'Text',
c3fc2621
CW
391 ],
392 ],
393 'is_default' => [
e501603b
TO
394 'name' => 'is_default',
395 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 396 'title' => ts('Is Default Price Field Option?'),
215b423e 397 'description' => ts('Is this default price field option'),
a36434b9 398 'where' => 'civicrm_price_field_value.is_default',
45a83e42 399 'default' => '0',
522a26c9 400 'table_name' => 'civicrm_price_field_value',
401 'entity' => 'PriceFieldValue',
402 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 403 'localizable' => 0,
c3fc2621 404 'html' => [
e501603b 405 'type' => 'CheckBox',
c3fc2621
CW
406 ],
407 ],
408 'is_active' => [
e501603b
TO
409 'name' => 'is_active',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 411 'title' => ts('Price Field Value is Active'),
215b423e 412 'description' => ts('Is this price field value active'),
a36434b9 413 'where' => 'civicrm_price_field_value.is_active',
e501603b 414 'default' => '1',
522a26c9 415 'table_name' => 'civicrm_price_field_value',
416 'entity' => 'PriceFieldValue',
417 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 418 'localizable' => 0,
c3fc2621
CW
419 ],
420 'financial_type_id' => [
e501603b
TO
421 'name' => 'financial_type_id',
422 'type' => CRM_Utils_Type::T_INT,
c3fc2621 423 'title' => ts('Financial Type'),
215b423e 424 'description' => ts('FK to Financial Type.'),
a36434b9 425 'where' => 'civicrm_price_field_value.financial_type_id',
e501603b 426 'default' => 'NULL',
522a26c9 427 'table_name' => 'civicrm_price_field_value',
428 'entity' => 'PriceFieldValue',
429 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 430 'localizable' => 0,
e501603b 431 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 432 'html' => [
e501603b 433 'type' => 'Select',
c3fc2621
CW
434 ],
435 'pseudoconstant' => [
e501603b
TO
436 'table' => 'civicrm_financial_type',
437 'keyColumn' => 'id',
438 'labelColumn' => 'name',
e6ca0a57 439 ],
c3fc2621
CW
440 ],
441 'non_deductible_amount' => [
5afce5ad 442 'name' => 'non_deductible_amount',
e501603b 443 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 444 'title' => ts('Non-deductible Amount'),
215b423e 445 'description' => ts('Portion of total amount which is NOT tax deductible.'),
c3fc2621
CW
446 'required' => TRUE,
447 'precision' => [
e501603b 448 20,
fb607354 449 2,
c3fc2621 450 ],
a36434b9 451 'where' => 'civicrm_price_field_value.non_deductible_amount',
452 'headerPattern' => '/non?.?deduct/i',
453 'dataPattern' => '/^\d+(\.\d{2})?$/',
e501603b 454 'default' => '0.0',
522a26c9 455 'table_name' => 'civicrm_price_field_value',
456 'entity' => 'PriceFieldValue',
457 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 458 'localizable' => 0,
c3fc2621 459 'html' => [
e501603b 460 'type' => 'Text',
c3fc2621
CW
461 ],
462 ],
463 'visibility_id' => [
2db35bf6
AF
464 'name' => 'visibility_id',
465 'type' => CRM_Utils_Type::T_INT,
c3fc2621 466 'title' => ts('Price Field Option Visibility'),
215b423e 467 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
a36434b9 468 'where' => 'civicrm_price_field_value.visibility_id',
2db35bf6
AF
469 'default' => '1',
470 'table_name' => 'civicrm_price_field_value',
471 'entity' => 'PriceFieldValue',
472 'bao' => 'CRM_Price_BAO_PriceFieldValue',
473 'localizable' => 0,
c3fc2621 474 'html' => [
2db35bf6 475 'type' => 'Select',
c3fc2621
CW
476 ],
477 'pseudoconstant' => [
2db35bf6
AF
478 'optionGroupName' => 'visibility',
479 'optionEditPath' => 'civicrm/admin/options/visibility',
e6ca0a57 480 ],
c3fc2621
CW
481 ],
482 ];
346aaaba 483 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 484 }
346aaaba 485 return Civi::$statics[__CLASS__]['fields'];
e501603b 486 }
c3fc2621 487
e501603b 488 /**
bd8e0b14 489 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
490 *
491 * @return array
bd8e0b14 492 * Array(string $name => string $uniqueName).
e501603b 493 */
c3fc2621 494 public static function &fieldKeys() {
bd8e0b14
TO
495 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
496 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 497 }
bd8e0b14 498 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 499 }
c3fc2621 500
e501603b
TO
501 /**
502 * Returns the names of this table
503 *
504 * @return string
505 */
c3fc2621 506 public static function getTableName() {
e501603b
TO
507 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
508 }
c3fc2621 509
e501603b
TO
510 /**
511 * Returns if this table needs to be logged
512 *
c3fc2621 513 * @return bool
e501603b 514 */
c3fc2621 515 public function getLog() {
e501603b
TO
516 return self::$_log;
517 }
c3fc2621 518
e501603b
TO
519 /**
520 * Returns the list of fields that can be imported
521 *
522 * @param bool $prefix
523 *
524 * @return array
525 */
c3fc2621
CW
526 public static function &import($prefix = FALSE) {
527 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, []);
60808919 528 return $r;
e501603b 529 }
c3fc2621 530
e501603b
TO
531 /**
532 * Returns the list of fields that can be exported
533 *
534 * @param bool $prefix
535 *
536 * @return array
537 */
c3fc2621
CW
538 public static function &export($prefix = FALSE) {
539 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, []);
60808919 540 return $r;
e501603b 541 }
c3fc2621 542
e7a6b91a
AS
543 /**
544 * Returns the list of indices
c3fc2621
CW
545 *
546 * @param bool $localize
547 *
548 * @return array
e7a6b91a
AS
549 */
550 public static function indices($localize = TRUE) {
c3fc2621 551 $indices = [];
e7a6b91a
AS
552 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
553 }
c3fc2621 554
e501603b 555}