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:691cc70f15386dd0c2cd4ab63f9798af)
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 foreign keys and entity references.
160 * [CRM_Core_Reference_Interface]
162 public static function getReferenceColumns() {
163 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
164 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
165 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
166 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
168 return Civi
::$statics[__CLASS__
]['links'];
172 * Returns all the column names of this table
176 public static function &fields() {
177 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
178 Civi
::$statics[__CLASS__
]['fields'] = [
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('Price Field ID'),
183 'description' => ts('Price Field'),
185 'where' => 'civicrm_price_field.id',
186 'table_name' => 'civicrm_price_field',
187 'entity' => 'PriceField',
188 'bao' => 'CRM_Price_BAO_PriceField',
192 'name' => 'price_set_id',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Price Set'),
195 'description' => ts('FK to civicrm_price_set'),
197 'where' => 'civicrm_price_field.price_set_id',
198 'table_name' => 'civicrm_price_field',
199 'entity' => 'PriceField',
200 'bao' => 'CRM_Price_BAO_PriceField',
202 'FKClassName' => 'CRM_Price_DAO_PriceSet',
203 'pseudoconstant' => [
204 'table' => 'civicrm_price_set',
206 'labelColumn' => 'title',
207 'nameColumn' => 'name',
212 'type' => CRM_Utils_Type
::T_STRING
,
213 'title' => ts('Name'),
214 'description' => ts('Variable name/programmatic handle for this field.'),
217 'size' => CRM_Utils_Type
::HUGE
,
218 'where' => 'civicrm_price_field.name',
219 'table_name' => 'civicrm_price_field',
220 'entity' => 'PriceField',
221 'bao' => 'CRM_Price_BAO_PriceField',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('Label'),
231 'description' => ts('Text for form field label (also friendly name for administering this field).'),
234 'size' => CRM_Utils_Type
::HUGE
,
235 'where' => 'civicrm_price_field.label',
236 'table_name' => 'civicrm_price_field',
237 'entity' => 'PriceField',
238 'bao' => 'CRM_Price_BAO_PriceField',
245 'name' => 'html_type',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Html Type'),
250 'size' => CRM_Utils_Type
::TWELVE
,
251 'where' => 'civicrm_price_field.html_type',
252 'table_name' => 'civicrm_price_field',
253 'entity' => 'PriceField',
254 'bao' => 'CRM_Price_BAO_PriceField',
259 'pseudoconstant' => [
260 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
264 'name' => 'is_enter_qty',
265 'type' => CRM_Utils_Type
::T_BOOLEAN
,
266 'title' => ts('Price Field Quantity Required?'),
267 'description' => ts('Enter a quantity for this field?'),
268 'where' => 'civicrm_price_field.is_enter_qty',
270 'table_name' => 'civicrm_price_field',
271 'entity' => 'PriceField',
272 'bao' => 'CRM_Price_BAO_PriceField',
275 'type' => 'CheckBox',
279 'name' => 'help_pre',
280 'type' => CRM_Utils_Type
::T_TEXT
,
281 'title' => ts('Price Field Pre Text'),
282 'description' => ts('Description and/or help text to display before this field.'),
285 'where' => 'civicrm_price_field.help_pre',
286 'table_name' => 'civicrm_price_field',
287 'entity' => 'PriceField',
288 'bao' => 'CRM_Price_BAO_PriceField',
291 'type' => 'TextArea',
295 'name' => 'help_post',
296 'type' => CRM_Utils_Type
::T_TEXT
,
297 'title' => ts('Price Field Post Text'),
298 'description' => ts('Description and/or help text to display after this field.'),
301 'where' => 'civicrm_price_field.help_post',
302 'table_name' => 'civicrm_price_field',
303 'entity' => 'PriceField',
304 'bao' => 'CRM_Price_BAO_PriceField',
307 'type' => 'TextArea',
312 'type' => CRM_Utils_Type
::T_INT
,
313 'title' => ts('Order'),
314 'description' => ts('Order in which the fields should appear'),
315 'where' => 'civicrm_price_field.weight',
317 'table_name' => 'civicrm_price_field',
318 'entity' => 'PriceField',
319 'bao' => 'CRM_Price_BAO_PriceField',
325 'is_display_amounts' => [
326 'name' => 'is_display_amounts',
327 'type' => CRM_Utils_Type
::T_BOOLEAN
,
328 'title' => ts('Price Field Show Amounts?'),
329 'description' => ts('Should the price be displayed next to the label for each option?'),
330 'where' => 'civicrm_price_field.is_display_amounts',
332 'table_name' => 'civicrm_price_field',
333 'entity' => 'PriceField',
334 'bao' => 'CRM_Price_BAO_PriceField',
337 'type' => 'CheckBox',
340 'options_per_line' => [
341 'name' => 'options_per_line',
342 'type' => CRM_Utils_Type
::T_INT
,
343 'title' => ts('Price Field Options per Row'),
344 'description' => ts('number of options per line for checkbox and radio'),
345 'where' => 'civicrm_price_field.options_per_line',
347 'table_name' => 'civicrm_price_field',
348 'entity' => 'PriceField',
349 'bao' => 'CRM_Price_BAO_PriceField',
356 'name' => 'is_active',
357 'type' => CRM_Utils_Type
::T_BOOLEAN
,
358 'title' => ts('Price Field Is Active?'),
359 'description' => ts('Is this price field active'),
360 'where' => 'civicrm_price_field.is_active',
362 'table_name' => 'civicrm_price_field',
363 'entity' => 'PriceField',
364 'bao' => 'CRM_Price_BAO_PriceField',
367 'type' => 'CheckBox',
371 'name' => 'is_required',
372 'type' => CRM_Utils_Type
::T_BOOLEAN
,
373 'title' => ts('Price Field is Required?'),
374 'description' => ts('Is this price field required (value must be > 1)'),
375 'where' => 'civicrm_price_field.is_required',
377 'table_name' => 'civicrm_price_field',
378 'entity' => 'PriceField',
379 'bao' => 'CRM_Price_BAO_PriceField',
382 'type' => 'CheckBox',
386 'name' => 'active_on',
387 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
388 'title' => ts('Price Field Start Date'),
389 'description' => ts('If non-zero, do not show this field before the date specified'),
390 'where' => 'civicrm_price_field.active_on',
392 'table_name' => 'civicrm_price_field',
393 'entity' => 'PriceField',
394 'bao' => 'CRM_Price_BAO_PriceField',
397 'type' => 'Select Date',
398 'formatType' => 'activityDateTime',
402 'name' => 'expire_on',
403 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
404 'title' => ts('Price Field End Date'),
405 'description' => ts('If non-zero, do not show this field after the date specified'),
406 'where' => 'civicrm_price_field.expire_on',
408 'table_name' => 'civicrm_price_field',
409 'entity' => 'PriceField',
410 'bao' => 'CRM_Price_BAO_PriceField',
413 'type' => 'Select Date',
414 'formatType' => 'activityDateTime',
418 'name' => 'javascript',
419 'type' => CRM_Utils_Type
::T_STRING
,
420 'title' => ts('Price Field Javascript'),
421 'description' => ts('Optional scripting attributes for field'),
423 'size' => CRM_Utils_Type
::HUGE
,
424 'where' => 'civicrm_price_field.javascript',
425 'table_name' => 'civicrm_price_field',
426 'entity' => 'PriceField',
427 'bao' => 'CRM_Price_BAO_PriceField',
434 'name' => 'visibility_id',
435 'type' => CRM_Utils_Type
::T_INT
,
436 'title' => ts('Price Field Visibility'),
437 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
438 'where' => 'civicrm_price_field.visibility_id',
440 'table_name' => 'civicrm_price_field',
441 'entity' => 'PriceField',
442 'bao' => 'CRM_Price_BAO_PriceField',
447 'pseudoconstant' => [
448 'optionGroupName' => 'visibility',
449 'optionEditPath' => 'civicrm/admin/options/visibility',
453 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
455 return Civi
::$statics[__CLASS__
]['fields'];
459 * Return a mapping from field-name to the corresponding key (as used in fields()).
462 * Array(string $name => string $uniqueName).
464 public static function &fieldKeys() {
465 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
466 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
468 return Civi
::$statics[__CLASS__
]['fieldKeys'];
472 * Returns the names of this table
476 public static function getTableName() {
477 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
481 * Returns if this table needs to be logged
485 public function getLog() {
490 * Returns the list of fields that can be imported
492 * @param bool $prefix
496 public static function &import($prefix = FALSE) {
497 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
502 * Returns the list of fields that can be exported
504 * @param bool $prefix
508 public static function &export($prefix = FALSE) {
509 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
514 * Returns the list of indices
516 * @param bool $localize
520 public static function indices($localize = TRUE) {
523 'name' => 'index_name',
527 'localizable' => FALSE,
528 'sig' => 'civicrm_price_field::0::name',
531 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;