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:55cd5fb830fb3ab53627aad3520b0740)
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',
209 'name' => 'price_set_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Price Set ID'),
212 'description' => ts('FK to civicrm_price_set'),
214 'where' => 'civicrm_price_field.price_set_id',
215 'table_name' => 'civicrm_price_field',
216 'entity' => 'PriceField',
217 'bao' => 'CRM_Price_BAO_PriceField',
219 'FKClassName' => 'CRM_Price_DAO_PriceSet',
221 'label' => ts("Price Set"),
223 'pseudoconstant' => [
224 'table' => 'civicrm_price_set',
226 'labelColumn' => 'title',
227 'nameColumn' => 'name',
233 'type' => CRM_Utils_Type
::T_STRING
,
234 'title' => ts('Name'),
235 'description' => ts('Variable name/programmatic handle for this field.'),
238 'size' => CRM_Utils_Type
::HUGE
,
239 'where' => 'civicrm_price_field.name',
240 'table_name' => 'civicrm_price_field',
241 'entity' => 'PriceField',
242 'bao' => 'CRM_Price_BAO_PriceField',
251 'type' => CRM_Utils_Type
::T_STRING
,
252 'title' => ts('Label'),
253 'description' => ts('Text for form field label (also friendly name for administering this field).'),
256 'size' => CRM_Utils_Type
::HUGE
,
257 'where' => 'civicrm_price_field.label',
258 'table_name' => 'civicrm_price_field',
259 'entity' => 'PriceField',
260 'bao' => 'CRM_Price_BAO_PriceField',
268 'name' => 'html_type',
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Html Type'),
273 'size' => CRM_Utils_Type
::TWELVE
,
274 'where' => 'civicrm_price_field.html_type',
275 'table_name' => 'civicrm_price_field',
276 'entity' => 'PriceField',
277 'bao' => 'CRM_Price_BAO_PriceField',
282 'pseudoconstant' => [
283 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
288 'name' => 'is_enter_qty',
289 'type' => CRM_Utils_Type
::T_BOOLEAN
,
290 'title' => ts('Price Field Quantity Required?'),
291 'description' => ts('Enter a quantity for this field?'),
292 'where' => 'civicrm_price_field.is_enter_qty',
294 'table_name' => 'civicrm_price_field',
295 'entity' => 'PriceField',
296 'bao' => 'CRM_Price_BAO_PriceField',
299 'type' => 'CheckBox',
304 'name' => 'help_pre',
305 'type' => CRM_Utils_Type
::T_TEXT
,
306 'title' => ts('Price Field Pre Text'),
307 'description' => ts('Description and/or help text to display before this field.'),
310 'where' => 'civicrm_price_field.help_pre',
311 'table_name' => 'civicrm_price_field',
312 'entity' => 'PriceField',
313 'bao' => 'CRM_Price_BAO_PriceField',
316 'type' => 'TextArea',
321 'name' => 'help_post',
322 'type' => CRM_Utils_Type
::T_TEXT
,
323 'title' => ts('Price Field Post Text'),
324 'description' => ts('Description and/or help text to display after this field.'),
327 'where' => 'civicrm_price_field.help_post',
328 'table_name' => 'civicrm_price_field',
329 'entity' => 'PriceField',
330 'bao' => 'CRM_Price_BAO_PriceField',
333 'type' => 'TextArea',
339 'type' => CRM_Utils_Type
::T_INT
,
340 'title' => ts('Order'),
341 'description' => ts('Order in which the fields should appear'),
342 'where' => 'civicrm_price_field.weight',
344 'table_name' => 'civicrm_price_field',
345 'entity' => 'PriceField',
346 'bao' => 'CRM_Price_BAO_PriceField',
353 'is_display_amounts' => [
354 'name' => 'is_display_amounts',
355 'type' => CRM_Utils_Type
::T_BOOLEAN
,
356 'title' => ts('Price Field Show Amounts?'),
357 'description' => ts('Should the price be displayed next to the label for each option?'),
358 'where' => 'civicrm_price_field.is_display_amounts',
360 'table_name' => 'civicrm_price_field',
361 'entity' => 'PriceField',
362 'bao' => 'CRM_Price_BAO_PriceField',
365 'type' => 'CheckBox',
369 'options_per_line' => [
370 'name' => 'options_per_line',
371 'type' => CRM_Utils_Type
::T_INT
,
372 'title' => ts('Price Field Options per Row'),
373 'description' => ts('number of options per line for checkbox and radio'),
374 'where' => 'civicrm_price_field.options_per_line',
376 'table_name' => 'civicrm_price_field',
377 'entity' => 'PriceField',
378 'bao' => 'CRM_Price_BAO_PriceField',
386 'name' => 'is_active',
387 'type' => CRM_Utils_Type
::T_BOOLEAN
,
388 'title' => ts('Price Field Is Active?'),
389 'description' => ts('Is this price field active'),
390 'where' => 'civicrm_price_field.is_active',
392 'table_name' => 'civicrm_price_field',
393 'entity' => 'PriceField',
394 'bao' => 'CRM_Price_BAO_PriceField',
397 'type' => 'CheckBox',
402 'name' => 'is_required',
403 'type' => CRM_Utils_Type
::T_BOOLEAN
,
404 'title' => ts('Price Field is Required?'),
405 'description' => ts('Is this price field required (value must be > 1)'),
406 'where' => 'civicrm_price_field.is_required',
408 'table_name' => 'civicrm_price_field',
409 'entity' => 'PriceField',
410 'bao' => 'CRM_Price_BAO_PriceField',
413 'type' => 'CheckBox',
418 'name' => 'active_on',
419 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
420 'title' => ts('Price Field Start Date'),
421 'description' => ts('If non-zero, do not show this field before the date specified'),
422 'where' => 'civicrm_price_field.active_on',
424 'table_name' => 'civicrm_price_field',
425 'entity' => 'PriceField',
426 'bao' => 'CRM_Price_BAO_PriceField',
429 'type' => 'Select Date',
430 'formatType' => 'activityDateTime',
435 'name' => 'expire_on',
436 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
437 'title' => ts('Price Field End Date'),
438 'description' => ts('If non-zero, do not show this field after the date specified'),
439 'where' => 'civicrm_price_field.expire_on',
441 'table_name' => 'civicrm_price_field',
442 'entity' => 'PriceField',
443 'bao' => 'CRM_Price_BAO_PriceField',
446 'type' => 'Select Date',
447 'formatType' => 'activityDateTime',
452 'name' => 'javascript',
453 'type' => CRM_Utils_Type
::T_STRING
,
454 'title' => ts('Price Field Javascript'),
455 'description' => ts('Optional scripting attributes for field'),
457 'size' => CRM_Utils_Type
::HUGE
,
458 'where' => 'civicrm_price_field.javascript',
459 'table_name' => 'civicrm_price_field',
460 'entity' => 'PriceField',
461 'bao' => 'CRM_Price_BAO_PriceField',
469 'name' => 'visibility_id',
470 'type' => CRM_Utils_Type
::T_INT
,
471 'title' => ts('Price Field Visibility'),
472 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
473 'where' => 'civicrm_price_field.visibility_id',
475 'table_name' => 'civicrm_price_field',
476 'entity' => 'PriceField',
477 'bao' => 'CRM_Price_BAO_PriceField',
482 'pseudoconstant' => [
483 'optionGroupName' => 'visibility',
484 'optionEditPath' => 'civicrm/admin/options/visibility',
489 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
491 return Civi
::$statics[__CLASS__
]['fields'];
495 * Return a mapping from field-name to the corresponding key (as used in fields()).
498 * Array(string $name => string $uniqueName).
500 public static function &fieldKeys() {
501 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
502 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
504 return Civi
::$statics[__CLASS__
]['fieldKeys'];
508 * Returns the names of this table
512 public static function getTableName() {
513 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
517 * Returns if this table needs to be logged
521 public function getLog() {
526 * Returns the list of fields that can be imported
528 * @param bool $prefix
532 public static function &import($prefix = FALSE) {
533 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
538 * Returns the list of fields that can be exported
540 * @param bool $prefix
544 public static function &export($prefix = FALSE) {
545 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
550 * Returns the list of indices
552 * @param bool $localize
556 public static function indices($localize = TRUE) {
559 'name' => 'index_name',
563 'localizable' => FALSE,
564 'sig' => 'civicrm_price_field::0::name',
567 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;