5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Price/PriceField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fdebc45a7d5c35abb0c9c480dbf201b2)
13 * Database access object for the PriceField entity.
15 class CRM_Price_DAO_PriceField
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.8';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_price_field';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
41 * FK to civicrm_price_set
48 * Variable name/programmatic handle for this field.
55 * Text for form field label (also friendly name for administering this field).
67 * Enter a quantity for this field?
74 * Description and/or help text to display before this field.
81 * Description and/or help text to display after this field.
88 * Order in which the fields should appear
95 * Should the price be displayed next to the label for each option?
99 public $is_display_amounts;
102 * number of options per line for checkbox and radio
106 public $options_per_line;
109 * Is this price field active
116 * Is this price field required (value must be > 1)
123 * If non-zero, do not show this field before the date specified
130 * If non-zero, do not show this field after the date specified
137 * Optional scripting attributes for field
144 * Implicit FK to civicrm_option_group with name = 'visibility'
148 public $visibility_id;
153 public function __construct() {
154 $this->__table
= 'civicrm_price_field';
155 parent
::__construct();
159 * Returns localized title of this entity.
161 * @param bool $plural
162 * Whether to return the plural version of the title.
164 public static function getEntityTitle($plural = FALSE) {
165 return $plural ?
ts('Price Fields') : ts('Price Field');
169 * Returns foreign keys and entity references.
172 * [CRM_Core_Reference_Interface]
174 public static function getReferenceColumns() {
175 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
176 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
177 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
178 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
180 return Civi
::$statics[__CLASS__
]['links'];
184 * Returns all the column names of this table
188 public static function &fields() {
189 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
190 Civi
::$statics[__CLASS__
]['fields'] = [
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Price Field ID'),
195 'description' => ts('Price Field'),
197 'where' => 'civicrm_price_field.id',
198 'table_name' => 'civicrm_price_field',
199 'entity' => 'PriceField',
200 'bao' => 'CRM_Price_BAO_PriceField',
205 'name' => 'price_set_id',
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Price Set'),
208 'description' => ts('FK to civicrm_price_set'),
210 'where' => 'civicrm_price_field.price_set_id',
211 'table_name' => 'civicrm_price_field',
212 'entity' => 'PriceField',
213 'bao' => 'CRM_Price_BAO_PriceField',
215 'FKClassName' => 'CRM_Price_DAO_PriceSet',
216 'pseudoconstant' => [
217 'table' => 'civicrm_price_set',
219 'labelColumn' => 'title',
220 'nameColumn' => 'name',
226 'type' => CRM_Utils_Type
::T_STRING
,
227 'title' => ts('Name'),
228 'description' => ts('Variable name/programmatic handle for this field.'),
231 'size' => CRM_Utils_Type
::HUGE
,
232 'where' => 'civicrm_price_field.name',
233 'table_name' => 'civicrm_price_field',
234 'entity' => 'PriceField',
235 'bao' => 'CRM_Price_BAO_PriceField',
244 'type' => CRM_Utils_Type
::T_STRING
,
245 'title' => ts('Label'),
246 'description' => ts('Text for form field label (also friendly name for administering this field).'),
249 'size' => CRM_Utils_Type
::HUGE
,
250 'where' => 'civicrm_price_field.label',
251 'table_name' => 'civicrm_price_field',
252 'entity' => 'PriceField',
253 'bao' => 'CRM_Price_BAO_PriceField',
261 'name' => 'html_type',
262 'type' => CRM_Utils_Type
::T_STRING
,
263 'title' => ts('Html Type'),
266 'size' => CRM_Utils_Type
::TWELVE
,
267 'where' => 'civicrm_price_field.html_type',
268 'table_name' => 'civicrm_price_field',
269 'entity' => 'PriceField',
270 'bao' => 'CRM_Price_BAO_PriceField',
275 'pseudoconstant' => [
276 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
281 'name' => 'is_enter_qty',
282 'type' => CRM_Utils_Type
::T_BOOLEAN
,
283 'title' => ts('Price Field Quantity Required?'),
284 'description' => ts('Enter a quantity for this field?'),
285 'where' => 'civicrm_price_field.is_enter_qty',
287 'table_name' => 'civicrm_price_field',
288 'entity' => 'PriceField',
289 'bao' => 'CRM_Price_BAO_PriceField',
292 'type' => 'CheckBox',
297 'name' => 'help_pre',
298 'type' => CRM_Utils_Type
::T_TEXT
,
299 'title' => ts('Price Field Pre Text'),
300 'description' => ts('Description and/or help text to display before this field.'),
303 'where' => 'civicrm_price_field.help_pre',
304 'table_name' => 'civicrm_price_field',
305 'entity' => 'PriceField',
306 'bao' => 'CRM_Price_BAO_PriceField',
309 'type' => 'TextArea',
314 'name' => 'help_post',
315 'type' => CRM_Utils_Type
::T_TEXT
,
316 'title' => ts('Price Field Post Text'),
317 'description' => ts('Description and/or help text to display after this field.'),
320 'where' => 'civicrm_price_field.help_post',
321 'table_name' => 'civicrm_price_field',
322 'entity' => 'PriceField',
323 'bao' => 'CRM_Price_BAO_PriceField',
326 'type' => 'TextArea',
332 'type' => CRM_Utils_Type
::T_INT
,
333 'title' => ts('Order'),
334 'description' => ts('Order in which the fields should appear'),
335 'where' => 'civicrm_price_field.weight',
337 'table_name' => 'civicrm_price_field',
338 'entity' => 'PriceField',
339 'bao' => 'CRM_Price_BAO_PriceField',
346 'is_display_amounts' => [
347 'name' => 'is_display_amounts',
348 'type' => CRM_Utils_Type
::T_BOOLEAN
,
349 'title' => ts('Price Field Show Amounts?'),
350 'description' => ts('Should the price be displayed next to the label for each option?'),
351 'where' => 'civicrm_price_field.is_display_amounts',
353 'table_name' => 'civicrm_price_field',
354 'entity' => 'PriceField',
355 'bao' => 'CRM_Price_BAO_PriceField',
358 'type' => 'CheckBox',
362 'options_per_line' => [
363 'name' => 'options_per_line',
364 'type' => CRM_Utils_Type
::T_INT
,
365 'title' => ts('Price Field Options per Row'),
366 'description' => ts('number of options per line for checkbox and radio'),
367 'where' => 'civicrm_price_field.options_per_line',
369 'table_name' => 'civicrm_price_field',
370 'entity' => 'PriceField',
371 'bao' => 'CRM_Price_BAO_PriceField',
379 'name' => 'is_active',
380 'type' => CRM_Utils_Type
::T_BOOLEAN
,
381 'title' => ts('Price Field Is Active?'),
382 'description' => ts('Is this price field active'),
383 'where' => 'civicrm_price_field.is_active',
385 'table_name' => 'civicrm_price_field',
386 'entity' => 'PriceField',
387 'bao' => 'CRM_Price_BAO_PriceField',
390 'type' => 'CheckBox',
395 'name' => 'is_required',
396 'type' => CRM_Utils_Type
::T_BOOLEAN
,
397 'title' => ts('Price Field is Required?'),
398 'description' => ts('Is this price field required (value must be > 1)'),
399 'where' => 'civicrm_price_field.is_required',
401 'table_name' => 'civicrm_price_field',
402 'entity' => 'PriceField',
403 'bao' => 'CRM_Price_BAO_PriceField',
406 'type' => 'CheckBox',
411 'name' => 'active_on',
412 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
413 'title' => ts('Price Field Start Date'),
414 'description' => ts('If non-zero, do not show this field before the date specified'),
415 'where' => 'civicrm_price_field.active_on',
417 'table_name' => 'civicrm_price_field',
418 'entity' => 'PriceField',
419 'bao' => 'CRM_Price_BAO_PriceField',
422 'type' => 'Select Date',
423 'formatType' => 'activityDateTime',
428 'name' => 'expire_on',
429 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
430 'title' => ts('Price Field End Date'),
431 'description' => ts('If non-zero, do not show this field after the date specified'),
432 'where' => 'civicrm_price_field.expire_on',
434 'table_name' => 'civicrm_price_field',
435 'entity' => 'PriceField',
436 'bao' => 'CRM_Price_BAO_PriceField',
439 'type' => 'Select Date',
440 'formatType' => 'activityDateTime',
445 'name' => 'javascript',
446 'type' => CRM_Utils_Type
::T_STRING
,
447 'title' => ts('Price Field Javascript'),
448 'description' => ts('Optional scripting attributes for field'),
450 'size' => CRM_Utils_Type
::HUGE
,
451 'where' => 'civicrm_price_field.javascript',
452 'table_name' => 'civicrm_price_field',
453 'entity' => 'PriceField',
454 'bao' => 'CRM_Price_BAO_PriceField',
462 'name' => 'visibility_id',
463 'type' => CRM_Utils_Type
::T_INT
,
464 'title' => ts('Price Field Visibility'),
465 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
466 'where' => 'civicrm_price_field.visibility_id',
468 'table_name' => 'civicrm_price_field',
469 'entity' => 'PriceField',
470 'bao' => 'CRM_Price_BAO_PriceField',
475 'pseudoconstant' => [
476 'optionGroupName' => 'visibility',
477 'optionEditPath' => 'civicrm/admin/options/visibility',
482 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
484 return Civi
::$statics[__CLASS__
]['fields'];
488 * Return a mapping from field-name to the corresponding key (as used in fields()).
491 * Array(string $name => string $uniqueName).
493 public static function &fieldKeys() {
494 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
495 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
497 return Civi
::$statics[__CLASS__
]['fieldKeys'];
501 * Returns the names of this table
505 public static function getTableName() {
506 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
510 * Returns if this table needs to be logged
514 public function getLog() {
519 * Returns the list of fields that can be imported
521 * @param bool $prefix
525 public static function &import($prefix = FALSE) {
526 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
531 * Returns the list of fields that can be exported
533 * @param bool $prefix
537 public static function &export($prefix = FALSE) {
538 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
543 * Returns the list of indices
545 * @param bool $localize
549 public static function indices($localize = TRUE) {
552 'name' => 'index_name',
556 'localizable' => FALSE,
557 'sig' => 'civicrm_price_field::0::name',
560 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;