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:1beb1154376828f4f0efda1cc5b12c6a)
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';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_price_field';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * FK to civicrm_price_set
49 * Variable name/programmatic handle for this field.
56 * Text for form field label (also friendly name for administering this field).
68 * Enter a quantity for this field?
75 * Description and/or help text to display before this field.
82 * Description and/or help text to display after this field.
89 * Order in which the fields should appear
96 * Should the price be displayed next to the label for each option?
100 public $is_display_amounts;
103 * number of options per line for checkbox and radio
107 public $options_per_line;
110 * Is this price field active
117 * Is this price field required (value must be > 1)
124 * If non-zero, do not show this field before the date specified
131 * If non-zero, do not show this field after the date specified
138 * Optional scripting attributes for field
145 * Implicit FK to civicrm_option_group with name = 'visibility'
149 public $visibility_id;
154 public function __construct() {
155 $this->__table
= 'civicrm_price_field';
156 parent
::__construct();
160 * Returns localized title of this entity.
162 * @param bool $plural
163 * Whether to return the plural version of the title.
165 public static function getEntityTitle($plural = FALSE) {
166 return $plural ?
ts('Price Fields') : ts('Price Field');
170 * Returns foreign keys and entity references.
173 * [CRM_Core_Reference_Interface]
175 public static function getReferenceColumns() {
176 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
177 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
178 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
179 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
181 return Civi
::$statics[__CLASS__
]['links'];
185 * Returns all the column names of this table
189 public static function &fields() {
190 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
191 Civi
::$statics[__CLASS__
]['fields'] = [
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Price Field ID'),
196 'description' => ts('Price Field'),
198 'where' => 'civicrm_price_field.id',
199 'table_name' => 'civicrm_price_field',
200 'entity' => 'PriceField',
201 'bao' => 'CRM_Price_BAO_PriceField',
210 'name' => 'price_set_id',
211 'type' => CRM_Utils_Type
::T_INT
,
212 'title' => ts('Price Set ID'),
213 'description' => ts('FK to civicrm_price_set'),
215 'where' => 'civicrm_price_field.price_set_id',
216 'table_name' => 'civicrm_price_field',
217 'entity' => 'PriceField',
218 'bao' => 'CRM_Price_BAO_PriceField',
220 'FKClassName' => 'CRM_Price_DAO_PriceSet',
222 'label' => ts("Price Set"),
224 'pseudoconstant' => [
225 'table' => 'civicrm_price_set',
227 'labelColumn' => 'title',
228 'nameColumn' => 'name',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Name'),
236 'description' => ts('Variable name/programmatic handle for this field.'),
239 'size' => CRM_Utils_Type
::HUGE
,
240 'where' => 'civicrm_price_field.name',
241 'table_name' => 'civicrm_price_field',
242 'entity' => 'PriceField',
243 'bao' => 'CRM_Price_BAO_PriceField',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Label'),
254 'description' => ts('Text for form field label (also friendly name for administering this field).'),
257 'size' => CRM_Utils_Type
::HUGE
,
258 'where' => 'civicrm_price_field.label',
259 'table_name' => 'civicrm_price_field',
260 'entity' => 'PriceField',
261 'bao' => 'CRM_Price_BAO_PriceField',
269 'name' => 'html_type',
270 'type' => CRM_Utils_Type
::T_STRING
,
271 'title' => ts('Html Type'),
274 'size' => CRM_Utils_Type
::TWELVE
,
275 'where' => 'civicrm_price_field.html_type',
276 'table_name' => 'civicrm_price_field',
277 'entity' => 'PriceField',
278 'bao' => 'CRM_Price_BAO_PriceField',
282 'label' => ts("Html Type"),
284 'pseudoconstant' => [
285 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
290 'name' => 'is_enter_qty',
291 'type' => CRM_Utils_Type
::T_BOOLEAN
,
292 'title' => ts('Price Field Quantity Required?'),
293 'description' => ts('Enter a quantity for this field?'),
294 'where' => 'civicrm_price_field.is_enter_qty',
296 'table_name' => 'civicrm_price_field',
297 'entity' => 'PriceField',
298 'bao' => 'CRM_Price_BAO_PriceField',
301 'type' => 'CheckBox',
306 'name' => 'help_pre',
307 'type' => CRM_Utils_Type
::T_TEXT
,
308 'title' => ts('Price Field Pre Text'),
309 'description' => ts('Description and/or help text to display before this field.'),
312 'where' => 'civicrm_price_field.help_pre',
313 'table_name' => 'civicrm_price_field',
314 'entity' => 'PriceField',
315 'bao' => 'CRM_Price_BAO_PriceField',
318 'type' => 'TextArea',
323 'name' => 'help_post',
324 'type' => CRM_Utils_Type
::T_TEXT
,
325 'title' => ts('Price Field Post Text'),
326 'description' => ts('Description and/or help text to display after this field.'),
329 'where' => 'civicrm_price_field.help_post',
330 'table_name' => 'civicrm_price_field',
331 'entity' => 'PriceField',
332 'bao' => 'CRM_Price_BAO_PriceField',
335 'type' => 'TextArea',
341 'type' => CRM_Utils_Type
::T_INT
,
342 'title' => ts('Order'),
343 'description' => ts('Order in which the fields should appear'),
344 'where' => 'civicrm_price_field.weight',
346 'table_name' => 'civicrm_price_field',
347 'entity' => 'PriceField',
348 'bao' => 'CRM_Price_BAO_PriceField',
355 'is_display_amounts' => [
356 'name' => 'is_display_amounts',
357 'type' => CRM_Utils_Type
::T_BOOLEAN
,
358 'title' => ts('Price Field Show Amounts?'),
359 'description' => ts('Should the price be displayed next to the label for each option?'),
360 'where' => 'civicrm_price_field.is_display_amounts',
362 'table_name' => 'civicrm_price_field',
363 'entity' => 'PriceField',
364 'bao' => 'CRM_Price_BAO_PriceField',
367 'type' => 'CheckBox',
371 'options_per_line' => [
372 'name' => 'options_per_line',
373 'type' => CRM_Utils_Type
::T_INT
,
374 'title' => ts('Price Field Options per Row'),
375 'description' => ts('number of options per line for checkbox and radio'),
376 'where' => 'civicrm_price_field.options_per_line',
378 'table_name' => 'civicrm_price_field',
379 'entity' => 'PriceField',
380 'bao' => 'CRM_Price_BAO_PriceField',
388 'name' => 'is_active',
389 'type' => CRM_Utils_Type
::T_BOOLEAN
,
390 'title' => ts('Price Field Is Active?'),
391 'description' => ts('Is this price field active'),
392 'where' => 'civicrm_price_field.is_active',
394 'table_name' => 'civicrm_price_field',
395 'entity' => 'PriceField',
396 'bao' => 'CRM_Price_BAO_PriceField',
399 'type' => 'CheckBox',
404 'name' => 'is_required',
405 'type' => CRM_Utils_Type
::T_BOOLEAN
,
406 'title' => ts('Price Field is Required?'),
407 'description' => ts('Is this price field required (value must be > 1)'),
408 'where' => 'civicrm_price_field.is_required',
410 'table_name' => 'civicrm_price_field',
411 'entity' => 'PriceField',
412 'bao' => 'CRM_Price_BAO_PriceField',
415 'type' => 'CheckBox',
420 'name' => 'active_on',
421 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
422 'title' => ts('Price Field Start Date'),
423 'description' => ts('If non-zero, do not show this field before the date specified'),
424 'where' => 'civicrm_price_field.active_on',
426 'table_name' => 'civicrm_price_field',
427 'entity' => 'PriceField',
428 'bao' => 'CRM_Price_BAO_PriceField',
431 'type' => 'Select Date',
432 'formatType' => 'activityDateTime',
437 'name' => 'expire_on',
438 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
439 'title' => ts('Price Field End Date'),
440 'description' => ts('If non-zero, do not show this field after the date specified'),
441 'where' => 'civicrm_price_field.expire_on',
443 'table_name' => 'civicrm_price_field',
444 'entity' => 'PriceField',
445 'bao' => 'CRM_Price_BAO_PriceField',
448 'type' => 'Select Date',
449 'formatType' => 'activityDateTime',
454 'name' => 'javascript',
455 'type' => CRM_Utils_Type
::T_STRING
,
456 'title' => ts('Price Field Javascript'),
457 'description' => ts('Optional scripting attributes for field'),
459 'size' => CRM_Utils_Type
::HUGE
,
460 'where' => 'civicrm_price_field.javascript',
461 'table_name' => 'civicrm_price_field',
462 'entity' => 'PriceField',
463 'bao' => 'CRM_Price_BAO_PriceField',
471 'name' => 'visibility_id',
472 'type' => CRM_Utils_Type
::T_INT
,
473 'title' => ts('Price Field Visibility'),
474 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
475 'where' => 'civicrm_price_field.visibility_id',
477 'table_name' => 'civicrm_price_field',
478 'entity' => 'PriceField',
479 'bao' => 'CRM_Price_BAO_PriceField',
484 'pseudoconstant' => [
485 'optionGroupName' => 'visibility',
486 'optionEditPath' => 'civicrm/admin/options/visibility',
491 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
493 return Civi
::$statics[__CLASS__
]['fields'];
497 * Return a mapping from field-name to the corresponding key (as used in fields()).
500 * Array(string $name => string $uniqueName).
502 public static function &fieldKeys() {
503 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
504 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
506 return Civi
::$statics[__CLASS__
]['fieldKeys'];
510 * Returns the names of this table
514 public static function getTableName() {
515 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
519 * Returns if this table needs to be logged
523 public function getLog() {
528 * Returns the list of fields that can be imported
530 * @param bool $prefix
534 public static function &import($prefix = FALSE) {
535 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
540 * Returns the list of fields that can be exported
542 * @param bool $prefix
546 public static function &export($prefix = FALSE) {
547 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
552 * Returns the list of indices
554 * @param bool $localize
558 public static function indices($localize = TRUE) {
561 'name' => 'index_name',
565 'localizable' => FALSE,
566 'sig' => 'civicrm_price_field::0::name',
569 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;