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:60b0dde8a1e8d4933abc6df200d99809)
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',
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Name'),
208 'description' => ts('Variable name/programmatic handle for this field.'),
211 'size' => CRM_Utils_Type
::HUGE
,
212 'where' => 'civicrm_price_field.name',
213 'table_name' => 'civicrm_price_field',
214 'entity' => 'PriceField',
215 'bao' => 'CRM_Price_BAO_PriceField',
223 'type' => CRM_Utils_Type
::T_STRING
,
224 'title' => ts('Label'),
225 'description' => ts('Text for form field label (also friendly name for administering this field).'),
228 'size' => CRM_Utils_Type
::HUGE
,
229 'where' => 'civicrm_price_field.label',
230 'table_name' => 'civicrm_price_field',
231 'entity' => 'PriceField',
232 'bao' => 'CRM_Price_BAO_PriceField',
239 'name' => 'html_type',
240 'type' => CRM_Utils_Type
::T_STRING
,
241 'title' => ts('Html Type'),
244 'size' => CRM_Utils_Type
::TWELVE
,
245 'where' => 'civicrm_price_field.html_type',
246 'table_name' => 'civicrm_price_field',
247 'entity' => 'PriceField',
248 'bao' => 'CRM_Price_BAO_PriceField',
253 'pseudoconstant' => [
254 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
258 'name' => 'is_enter_qty',
259 'type' => CRM_Utils_Type
::T_BOOLEAN
,
260 'title' => ts('Price Field Quantity Required?'),
261 'description' => ts('Enter a quantity for this field?'),
262 'where' => 'civicrm_price_field.is_enter_qty',
264 'table_name' => 'civicrm_price_field',
265 'entity' => 'PriceField',
266 'bao' => 'CRM_Price_BAO_PriceField',
269 'type' => 'CheckBox',
273 'name' => 'help_pre',
274 'type' => CRM_Utils_Type
::T_TEXT
,
275 'title' => ts('Price Field Pre Text'),
276 'description' => ts('Description and/or help text to display before this field.'),
279 'where' => 'civicrm_price_field.help_pre',
280 'table_name' => 'civicrm_price_field',
281 'entity' => 'PriceField',
282 'bao' => 'CRM_Price_BAO_PriceField',
285 'type' => 'TextArea',
289 'name' => 'help_post',
290 'type' => CRM_Utils_Type
::T_TEXT
,
291 'title' => ts('Price Field Post Text'),
292 'description' => ts('Description and/or help text to display after this field.'),
295 'where' => 'civicrm_price_field.help_post',
296 'table_name' => 'civicrm_price_field',
297 'entity' => 'PriceField',
298 'bao' => 'CRM_Price_BAO_PriceField',
301 'type' => 'TextArea',
306 'type' => CRM_Utils_Type
::T_INT
,
307 'title' => ts('Order'),
308 'description' => ts('Order in which the fields should appear'),
309 'where' => 'civicrm_price_field.weight',
311 'table_name' => 'civicrm_price_field',
312 'entity' => 'PriceField',
313 'bao' => 'CRM_Price_BAO_PriceField',
319 'is_display_amounts' => [
320 'name' => 'is_display_amounts',
321 'type' => CRM_Utils_Type
::T_BOOLEAN
,
322 'title' => ts('Price Field Show Amounts?'),
323 'description' => ts('Should the price be displayed next to the label for each option?'),
324 'where' => 'civicrm_price_field.is_display_amounts',
326 'table_name' => 'civicrm_price_field',
327 'entity' => 'PriceField',
328 'bao' => 'CRM_Price_BAO_PriceField',
331 'type' => 'CheckBox',
334 'options_per_line' => [
335 'name' => 'options_per_line',
336 'type' => CRM_Utils_Type
::T_INT
,
337 'title' => ts('Price Field Options per Row'),
338 'description' => ts('number of options per line for checkbox and radio'),
339 'where' => 'civicrm_price_field.options_per_line',
341 'table_name' => 'civicrm_price_field',
342 'entity' => 'PriceField',
343 'bao' => 'CRM_Price_BAO_PriceField',
350 'name' => 'is_active',
351 'type' => CRM_Utils_Type
::T_BOOLEAN
,
352 'title' => ts('Price Field Is Active?'),
353 'description' => ts('Is this price field active'),
354 'where' => 'civicrm_price_field.is_active',
356 'table_name' => 'civicrm_price_field',
357 'entity' => 'PriceField',
358 'bao' => 'CRM_Price_BAO_PriceField',
361 'type' => 'CheckBox',
365 'name' => 'is_required',
366 'type' => CRM_Utils_Type
::T_BOOLEAN
,
367 'title' => ts('Price Field is Required?'),
368 'description' => ts('Is this price field required (value must be > 1)'),
369 'where' => 'civicrm_price_field.is_required',
371 'table_name' => 'civicrm_price_field',
372 'entity' => 'PriceField',
373 'bao' => 'CRM_Price_BAO_PriceField',
376 'type' => 'CheckBox',
380 'name' => 'active_on',
381 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
382 'title' => ts('Price Field Start Date'),
383 'description' => ts('If non-zero, do not show this field before the date specified'),
384 'where' => 'civicrm_price_field.active_on',
386 'table_name' => 'civicrm_price_field',
387 'entity' => 'PriceField',
388 'bao' => 'CRM_Price_BAO_PriceField',
391 'type' => 'Select Date',
392 'formatType' => 'activityDateTime',
396 'name' => 'expire_on',
397 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
398 'title' => ts('Price Field End Date'),
399 'description' => ts('If non-zero, do not show this field after the date specified'),
400 'where' => 'civicrm_price_field.expire_on',
402 'table_name' => 'civicrm_price_field',
403 'entity' => 'PriceField',
404 'bao' => 'CRM_Price_BAO_PriceField',
407 'type' => 'Select Date',
408 'formatType' => 'activityDateTime',
412 'name' => 'javascript',
413 'type' => CRM_Utils_Type
::T_STRING
,
414 'title' => ts('Price Field Javascript'),
415 'description' => ts('Optional scripting attributes for field'),
417 'size' => CRM_Utils_Type
::HUGE
,
418 'where' => 'civicrm_price_field.javascript',
419 'table_name' => 'civicrm_price_field',
420 'entity' => 'PriceField',
421 'bao' => 'CRM_Price_BAO_PriceField',
428 'name' => 'visibility_id',
429 'type' => CRM_Utils_Type
::T_INT
,
430 'title' => ts('Price Field Visibility'),
431 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
432 'where' => 'civicrm_price_field.visibility_id',
434 'table_name' => 'civicrm_price_field',
435 'entity' => 'PriceField',
436 'bao' => 'CRM_Price_BAO_PriceField',
441 'pseudoconstant' => [
442 'optionGroupName' => 'visibility',
443 'optionEditPath' => 'civicrm/admin/options/visibility',
447 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
449 return Civi
::$statics[__CLASS__
]['fields'];
453 * Return a mapping from field-name to the corresponding key (as used in fields()).
456 * Array(string $name => string $uniqueName).
458 public static function &fieldKeys() {
459 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
460 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
462 return Civi
::$statics[__CLASS__
]['fieldKeys'];
466 * Returns the names of this table
470 public static function getTableName() {
471 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
475 * Returns if this table needs to be logged
479 public function getLog() {
484 * Returns the list of fields that can be imported
486 * @param bool $prefix
490 public static function &import($prefix = FALSE) {
491 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
496 * Returns the list of fields that can be exported
498 * @param bool $prefix
502 public static function &export($prefix = FALSE) {
503 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
508 * Returns the list of indices
510 * @param bool $localize
514 public static function indices($localize = TRUE) {
517 'name' => 'index_name',
521 'localizable' => FALSE,
522 'sig' => 'civicrm_price_field::0::name',
525 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;