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:9449b207c28052d794e6d0c9d179f51c)
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',
223 'label' => ts("Price Set"),
225 'pseudoconstant' => [
226 'table' => 'civicrm_price_set',
228 'labelColumn' => 'title',
229 'nameColumn' => 'name',
235 'type' => CRM_Utils_Type
::T_STRING
,
236 'title' => ts('Name'),
237 'description' => ts('Variable name/programmatic handle for this field.'),
240 'size' => CRM_Utils_Type
::HUGE
,
241 'where' => 'civicrm_price_field.name',
242 'table_name' => 'civicrm_price_field',
243 'entity' => 'PriceField',
244 'bao' => 'CRM_Price_BAO_PriceField',
253 'type' => CRM_Utils_Type
::T_STRING
,
254 'title' => ts('Label'),
255 'description' => ts('Text for form field label (also friendly name for administering this field).'),
258 'size' => CRM_Utils_Type
::HUGE
,
259 'where' => 'civicrm_price_field.label',
260 'table_name' => 'civicrm_price_field',
261 'entity' => 'PriceField',
262 'bao' => 'CRM_Price_BAO_PriceField',
270 'name' => 'html_type',
271 'type' => CRM_Utils_Type
::T_STRING
,
272 'title' => ts('Html Type'),
275 'size' => CRM_Utils_Type
::TWELVE
,
276 'where' => 'civicrm_price_field.html_type',
277 'table_name' => 'civicrm_price_field',
278 'entity' => 'PriceField',
279 'bao' => 'CRM_Price_BAO_PriceField',
283 'label' => ts("Html Type"),
285 'pseudoconstant' => [
286 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
291 'name' => 'is_enter_qty',
292 'type' => CRM_Utils_Type
::T_BOOLEAN
,
293 'title' => ts('Price Field Quantity Required?'),
294 'description' => ts('Enter a quantity for this field?'),
295 'where' => 'civicrm_price_field.is_enter_qty',
297 'table_name' => 'civicrm_price_field',
298 'entity' => 'PriceField',
299 'bao' => 'CRM_Price_BAO_PriceField',
302 'type' => 'CheckBox',
307 'name' => 'help_pre',
308 'type' => CRM_Utils_Type
::T_TEXT
,
309 'title' => ts('Price Field Pre Text'),
310 'description' => ts('Description and/or help text to display before this field.'),
313 'where' => 'civicrm_price_field.help_pre',
314 'table_name' => 'civicrm_price_field',
315 'entity' => 'PriceField',
316 'bao' => 'CRM_Price_BAO_PriceField',
319 'type' => 'TextArea',
324 'name' => 'help_post',
325 'type' => CRM_Utils_Type
::T_TEXT
,
326 'title' => ts('Price Field Post Text'),
327 'description' => ts('Description and/or help text to display after this field.'),
330 'where' => 'civicrm_price_field.help_post',
331 'table_name' => 'civicrm_price_field',
332 'entity' => 'PriceField',
333 'bao' => 'CRM_Price_BAO_PriceField',
336 'type' => 'TextArea',
342 'type' => CRM_Utils_Type
::T_INT
,
343 'title' => ts('Order'),
344 'description' => ts('Order in which the fields should appear'),
345 'where' => 'civicrm_price_field.weight',
347 'table_name' => 'civicrm_price_field',
348 'entity' => 'PriceField',
349 'bao' => 'CRM_Price_BAO_PriceField',
356 'is_display_amounts' => [
357 'name' => 'is_display_amounts',
358 'type' => CRM_Utils_Type
::T_BOOLEAN
,
359 'title' => ts('Price Field Show Amounts?'),
360 'description' => ts('Should the price be displayed next to the label for each option?'),
361 'where' => 'civicrm_price_field.is_display_amounts',
363 'table_name' => 'civicrm_price_field',
364 'entity' => 'PriceField',
365 'bao' => 'CRM_Price_BAO_PriceField',
368 'type' => 'CheckBox',
372 'options_per_line' => [
373 'name' => 'options_per_line',
374 'type' => CRM_Utils_Type
::T_INT
,
375 'title' => ts('Price Field Options per Row'),
376 'description' => ts('number of options per line for checkbox and radio'),
377 'where' => 'civicrm_price_field.options_per_line',
379 'table_name' => 'civicrm_price_field',
380 'entity' => 'PriceField',
381 'bao' => 'CRM_Price_BAO_PriceField',
389 'name' => 'is_active',
390 'type' => CRM_Utils_Type
::T_BOOLEAN
,
391 'title' => ts('Price Field Is Active?'),
392 'description' => ts('Is this price field active'),
393 'where' => 'civicrm_price_field.is_active',
395 'table_name' => 'civicrm_price_field',
396 'entity' => 'PriceField',
397 'bao' => 'CRM_Price_BAO_PriceField',
400 'type' => 'CheckBox',
405 'name' => 'is_required',
406 'type' => CRM_Utils_Type
::T_BOOLEAN
,
407 'title' => ts('Price Field is Required?'),
408 'description' => ts('Is this price field required (value must be > 1)'),
409 'where' => 'civicrm_price_field.is_required',
411 'table_name' => 'civicrm_price_field',
412 'entity' => 'PriceField',
413 'bao' => 'CRM_Price_BAO_PriceField',
416 'type' => 'CheckBox',
421 'name' => 'active_on',
422 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
423 'title' => ts('Price Field Start Date'),
424 'description' => ts('If non-zero, do not show this field before the date specified'),
425 'where' => 'civicrm_price_field.active_on',
427 'table_name' => 'civicrm_price_field',
428 'entity' => 'PriceField',
429 'bao' => 'CRM_Price_BAO_PriceField',
432 'type' => 'Select Date',
433 'formatType' => 'activityDateTime',
438 'name' => 'expire_on',
439 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
440 'title' => ts('Price Field End Date'),
441 'description' => ts('If non-zero, do not show this field after the date specified'),
442 'where' => 'civicrm_price_field.expire_on',
444 'table_name' => 'civicrm_price_field',
445 'entity' => 'PriceField',
446 'bao' => 'CRM_Price_BAO_PriceField',
449 'type' => 'Select Date',
450 'formatType' => 'activityDateTime',
455 'name' => 'javascript',
456 'type' => CRM_Utils_Type
::T_STRING
,
457 'title' => ts('Price Field Javascript'),
458 'description' => ts('Optional scripting attributes for field'),
460 'size' => CRM_Utils_Type
::HUGE
,
461 'where' => 'civicrm_price_field.javascript',
462 'table_name' => 'civicrm_price_field',
463 'entity' => 'PriceField',
464 'bao' => 'CRM_Price_BAO_PriceField',
472 'name' => 'visibility_id',
473 'type' => CRM_Utils_Type
::T_INT
,
474 'title' => ts('Price Field Visibility'),
475 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
476 'where' => 'civicrm_price_field.visibility_id',
478 'table_name' => 'civicrm_price_field',
479 'entity' => 'PriceField',
480 'bao' => 'CRM_Price_BAO_PriceField',
485 'pseudoconstant' => [
486 'optionGroupName' => 'visibility',
487 'optionEditPath' => 'civicrm/admin/options/visibility',
492 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
494 return Civi
::$statics[__CLASS__
]['fields'];
498 * Return a mapping from field-name to the corresponding key (as used in fields()).
501 * Array(string $name => string $uniqueName).
503 public static function &fieldKeys() {
504 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
505 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
507 return Civi
::$statics[__CLASS__
]['fieldKeys'];
511 * Returns the names of this table
515 public static function getTableName() {
516 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
520 * Returns if this table needs to be logged
524 public function getLog() {
529 * Returns the list of fields that can be imported
531 * @param bool $prefix
535 public static function &import($prefix = FALSE) {
536 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
541 * Returns the list of fields that can be exported
543 * @param bool $prefix
547 public static function &export($prefix = FALSE) {
548 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
553 * Returns the list of indices
555 * @param bool $localize
559 public static function indices($localize = TRUE) {
562 'name' => 'index_name',
566 'localizable' => FALSE,
567 'sig' => 'civicrm_price_field::0::name',
570 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;