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