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:7e0a818f8b8641ca3bae0abe1582c8ce)
13 * Database access object for the PriceField entity.
15 class CRM_Price_DAO_PriceField
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_price_field';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * FK to civicrm_price_set
46 * Variable name/programmatic handle for this field.
53 * Text for form field label (also friendly name for administering this field).
65 * Enter a quantity for this field?
72 * Description and/or help text to display before this field.
79 * Description and/or help text to display after this field.
86 * Order in which the fields should appear
93 * Should the price be displayed next to the label for each option?
97 public $is_display_amounts;
100 * number of options per line for checkbox and radio
104 public $options_per_line;
107 * Is this price field active
114 * Is this price field required (value must be > 1)
121 * If non-zero, do not show this field before the date specified
128 * If non-zero, do not show this field after the date specified
135 * Optional scripting attributes for field
142 * Implicit FK to civicrm_option_group with name = 'visibility'
146 public $visibility_id;
151 public function __construct() {
152 $this->__table
= 'civicrm_price_field';
153 parent
::__construct();
157 * Returns localized title of this entity.
159 public static function getEntityTitle() {
160 return ts('Price Fields');
164 * Returns foreign keys and entity references.
167 * [CRM_Core_Reference_Interface]
169 public static function getReferenceColumns() {
170 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
171 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
173 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
175 return Civi
::$statics[__CLASS__
]['links'];
179 * Returns all the column names of this table
183 public static function &fields() {
184 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
185 Civi
::$statics[__CLASS__
]['fields'] = [
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Price Field ID'),
190 'description' => ts('Price Field'),
192 'where' => 'civicrm_price_field.id',
193 'table_name' => 'civicrm_price_field',
194 'entity' => 'PriceField',
195 'bao' => 'CRM_Price_BAO_PriceField',
200 'name' => 'price_set_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Price Set'),
203 'description' => ts('FK to civicrm_price_set'),
205 'where' => 'civicrm_price_field.price_set_id',
206 'table_name' => 'civicrm_price_field',
207 'entity' => 'PriceField',
208 'bao' => 'CRM_Price_BAO_PriceField',
210 'FKClassName' => 'CRM_Price_DAO_PriceSet',
211 'pseudoconstant' => [
212 'table' => 'civicrm_price_set',
214 'labelColumn' => 'title',
215 'nameColumn' => 'name',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Name'),
223 'description' => ts('Variable name/programmatic handle for this field.'),
226 'size' => CRM_Utils_Type
::HUGE
,
227 'where' => 'civicrm_price_field.name',
228 'table_name' => 'civicrm_price_field',
229 'entity' => 'PriceField',
230 'bao' => 'CRM_Price_BAO_PriceField',
239 'type' => CRM_Utils_Type
::T_STRING
,
240 'title' => ts('Label'),
241 'description' => ts('Text for form field label (also friendly name for administering this field).'),
244 'size' => CRM_Utils_Type
::HUGE
,
245 'where' => 'civicrm_price_field.label',
246 'table_name' => 'civicrm_price_field',
247 'entity' => 'PriceField',
248 'bao' => 'CRM_Price_BAO_PriceField',
256 'name' => 'html_type',
257 'type' => CRM_Utils_Type
::T_STRING
,
258 'title' => ts('Html Type'),
261 'size' => CRM_Utils_Type
::TWELVE
,
262 'where' => 'civicrm_price_field.html_type',
263 'table_name' => 'civicrm_price_field',
264 'entity' => 'PriceField',
265 'bao' => 'CRM_Price_BAO_PriceField',
270 'pseudoconstant' => [
271 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
276 'name' => 'is_enter_qty',
277 'type' => CRM_Utils_Type
::T_BOOLEAN
,
278 'title' => ts('Price Field Quantity Required?'),
279 'description' => ts('Enter a quantity for this field?'),
280 'where' => 'civicrm_price_field.is_enter_qty',
282 'table_name' => 'civicrm_price_field',
283 'entity' => 'PriceField',
284 'bao' => 'CRM_Price_BAO_PriceField',
287 'type' => 'CheckBox',
292 'name' => 'help_pre',
293 'type' => CRM_Utils_Type
::T_TEXT
,
294 'title' => ts('Price Field Pre Text'),
295 'description' => ts('Description and/or help text to display before this field.'),
298 'where' => 'civicrm_price_field.help_pre',
299 'table_name' => 'civicrm_price_field',
300 'entity' => 'PriceField',
301 'bao' => 'CRM_Price_BAO_PriceField',
304 'type' => 'TextArea',
309 'name' => 'help_post',
310 'type' => CRM_Utils_Type
::T_TEXT
,
311 'title' => ts('Price Field Post Text'),
312 'description' => ts('Description and/or help text to display after this field.'),
315 'where' => 'civicrm_price_field.help_post',
316 'table_name' => 'civicrm_price_field',
317 'entity' => 'PriceField',
318 'bao' => 'CRM_Price_BAO_PriceField',
321 'type' => 'TextArea',
327 'type' => CRM_Utils_Type
::T_INT
,
328 'title' => ts('Order'),
329 'description' => ts('Order in which the fields should appear'),
330 'where' => 'civicrm_price_field.weight',
332 'table_name' => 'civicrm_price_field',
333 'entity' => 'PriceField',
334 'bao' => 'CRM_Price_BAO_PriceField',
341 'is_display_amounts' => [
342 'name' => 'is_display_amounts',
343 'type' => CRM_Utils_Type
::T_BOOLEAN
,
344 'title' => ts('Price Field Show Amounts?'),
345 'description' => ts('Should the price be displayed next to the label for each option?'),
346 'where' => 'civicrm_price_field.is_display_amounts',
348 'table_name' => 'civicrm_price_field',
349 'entity' => 'PriceField',
350 'bao' => 'CRM_Price_BAO_PriceField',
353 'type' => 'CheckBox',
357 'options_per_line' => [
358 'name' => 'options_per_line',
359 'type' => CRM_Utils_Type
::T_INT
,
360 'title' => ts('Price Field Options per Row'),
361 'description' => ts('number of options per line for checkbox and radio'),
362 'where' => 'civicrm_price_field.options_per_line',
364 'table_name' => 'civicrm_price_field',
365 'entity' => 'PriceField',
366 'bao' => 'CRM_Price_BAO_PriceField',
374 'name' => 'is_active',
375 'type' => CRM_Utils_Type
::T_BOOLEAN
,
376 'title' => ts('Price Field Is Active?'),
377 'description' => ts('Is this price field active'),
378 'where' => 'civicrm_price_field.is_active',
380 'table_name' => 'civicrm_price_field',
381 'entity' => 'PriceField',
382 'bao' => 'CRM_Price_BAO_PriceField',
385 'type' => 'CheckBox',
390 'name' => 'is_required',
391 'type' => CRM_Utils_Type
::T_BOOLEAN
,
392 'title' => ts('Price Field is Required?'),
393 'description' => ts('Is this price field required (value must be > 1)'),
394 'where' => 'civicrm_price_field.is_required',
396 'table_name' => 'civicrm_price_field',
397 'entity' => 'PriceField',
398 'bao' => 'CRM_Price_BAO_PriceField',
401 'type' => 'CheckBox',
406 'name' => 'active_on',
407 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
408 'title' => ts('Price Field Start Date'),
409 'description' => ts('If non-zero, do not show this field before the date specified'),
410 'where' => 'civicrm_price_field.active_on',
412 'table_name' => 'civicrm_price_field',
413 'entity' => 'PriceField',
414 'bao' => 'CRM_Price_BAO_PriceField',
417 'type' => 'Select Date',
418 'formatType' => 'activityDateTime',
423 'name' => 'expire_on',
424 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
425 'title' => ts('Price Field End Date'),
426 'description' => ts('If non-zero, do not show this field after the date specified'),
427 'where' => 'civicrm_price_field.expire_on',
429 'table_name' => 'civicrm_price_field',
430 'entity' => 'PriceField',
431 'bao' => 'CRM_Price_BAO_PriceField',
434 'type' => 'Select Date',
435 'formatType' => 'activityDateTime',
440 'name' => 'javascript',
441 'type' => CRM_Utils_Type
::T_STRING
,
442 'title' => ts('Price Field Javascript'),
443 'description' => ts('Optional scripting attributes for field'),
445 'size' => CRM_Utils_Type
::HUGE
,
446 'where' => 'civicrm_price_field.javascript',
447 'table_name' => 'civicrm_price_field',
448 'entity' => 'PriceField',
449 'bao' => 'CRM_Price_BAO_PriceField',
457 'name' => 'visibility_id',
458 'type' => CRM_Utils_Type
::T_INT
,
459 'title' => ts('Price Field Visibility'),
460 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
461 'where' => 'civicrm_price_field.visibility_id',
463 'table_name' => 'civicrm_price_field',
464 'entity' => 'PriceField',
465 'bao' => 'CRM_Price_BAO_PriceField',
470 'pseudoconstant' => [
471 'optionGroupName' => 'visibility',
472 'optionEditPath' => 'civicrm/admin/options/visibility',
477 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
479 return Civi
::$statics[__CLASS__
]['fields'];
483 * Return a mapping from field-name to the corresponding key (as used in fields()).
486 * Array(string $name => string $uniqueName).
488 public static function &fieldKeys() {
489 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
490 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
492 return Civi
::$statics[__CLASS__
]['fieldKeys'];
496 * Returns the names of this table
500 public static function getTableName() {
501 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
505 * Returns if this table needs to be logged
509 public function getLog() {
514 * Returns the list of fields that can be imported
516 * @param bool $prefix
520 public static function &import($prefix = FALSE) {
521 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
526 * Returns the list of fields that can be exported
528 * @param bool $prefix
532 public static function &export($prefix = FALSE) {
533 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
538 * Returns the list of indices
540 * @param bool $localize
544 public static function indices($localize = TRUE) {
547 'name' => 'index_name',
551 'localizable' => FALSE,
552 'sig' => 'civicrm_price_field::0::name',
555 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;