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:6e47994bc98a74964af2347e6f93ad23)
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',
199 'name' => 'price_set_id',
200 'type' => CRM_Utils_Type
::T_INT
,
201 'title' => ts('Price Set'),
202 'description' => ts('FK to civicrm_price_set'),
204 'where' => 'civicrm_price_field.price_set_id',
205 'table_name' => 'civicrm_price_field',
206 'entity' => 'PriceField',
207 'bao' => 'CRM_Price_BAO_PriceField',
209 'FKClassName' => 'CRM_Price_DAO_PriceSet',
210 'pseudoconstant' => [
211 'table' => 'civicrm_price_set',
213 'labelColumn' => 'title',
214 'nameColumn' => 'name',
219 'type' => CRM_Utils_Type
::T_STRING
,
220 'title' => ts('Name'),
221 'description' => ts('Variable name/programmatic handle for this field.'),
224 'size' => CRM_Utils_Type
::HUGE
,
225 'where' => 'civicrm_price_field.name',
226 'table_name' => 'civicrm_price_field',
227 'entity' => 'PriceField',
228 'bao' => 'CRM_Price_BAO_PriceField',
236 'type' => CRM_Utils_Type
::T_STRING
,
237 'title' => ts('Label'),
238 'description' => ts('Text for form field label (also friendly name for administering this field).'),
241 'size' => CRM_Utils_Type
::HUGE
,
242 'where' => 'civicrm_price_field.label',
243 'table_name' => 'civicrm_price_field',
244 'entity' => 'PriceField',
245 'bao' => 'CRM_Price_BAO_PriceField',
252 'name' => 'html_type',
253 'type' => CRM_Utils_Type
::T_STRING
,
254 'title' => ts('Html Type'),
257 'size' => CRM_Utils_Type
::TWELVE
,
258 'where' => 'civicrm_price_field.html_type',
259 'table_name' => 'civicrm_price_field',
260 'entity' => 'PriceField',
261 'bao' => 'CRM_Price_BAO_PriceField',
266 'pseudoconstant' => [
267 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
271 'name' => 'is_enter_qty',
272 'type' => CRM_Utils_Type
::T_BOOLEAN
,
273 'title' => ts('Price Field Quantity Required?'),
274 'description' => ts('Enter a quantity for this field?'),
275 'where' => 'civicrm_price_field.is_enter_qty',
277 'table_name' => 'civicrm_price_field',
278 'entity' => 'PriceField',
279 'bao' => 'CRM_Price_BAO_PriceField',
282 'type' => 'CheckBox',
286 'name' => 'help_pre',
287 'type' => CRM_Utils_Type
::T_TEXT
,
288 'title' => ts('Price Field Pre Text'),
289 'description' => ts('Description and/or help text to display before this field.'),
292 'where' => 'civicrm_price_field.help_pre',
293 'table_name' => 'civicrm_price_field',
294 'entity' => 'PriceField',
295 'bao' => 'CRM_Price_BAO_PriceField',
298 'type' => 'TextArea',
302 'name' => 'help_post',
303 'type' => CRM_Utils_Type
::T_TEXT
,
304 'title' => ts('Price Field Post Text'),
305 'description' => ts('Description and/or help text to display after this field.'),
308 'where' => 'civicrm_price_field.help_post',
309 'table_name' => 'civicrm_price_field',
310 'entity' => 'PriceField',
311 'bao' => 'CRM_Price_BAO_PriceField',
314 'type' => 'TextArea',
319 'type' => CRM_Utils_Type
::T_INT
,
320 'title' => ts('Order'),
321 'description' => ts('Order in which the fields should appear'),
322 'where' => 'civicrm_price_field.weight',
324 'table_name' => 'civicrm_price_field',
325 'entity' => 'PriceField',
326 'bao' => 'CRM_Price_BAO_PriceField',
332 'is_display_amounts' => [
333 'name' => 'is_display_amounts',
334 'type' => CRM_Utils_Type
::T_BOOLEAN
,
335 'title' => ts('Price Field Show Amounts?'),
336 'description' => ts('Should the price be displayed next to the label for each option?'),
337 'where' => 'civicrm_price_field.is_display_amounts',
339 'table_name' => 'civicrm_price_field',
340 'entity' => 'PriceField',
341 'bao' => 'CRM_Price_BAO_PriceField',
344 'type' => 'CheckBox',
347 'options_per_line' => [
348 'name' => 'options_per_line',
349 'type' => CRM_Utils_Type
::T_INT
,
350 'title' => ts('Price Field Options per Row'),
351 'description' => ts('number of options per line for checkbox and radio'),
352 'where' => 'civicrm_price_field.options_per_line',
354 'table_name' => 'civicrm_price_field',
355 'entity' => 'PriceField',
356 'bao' => 'CRM_Price_BAO_PriceField',
363 'name' => 'is_active',
364 'type' => CRM_Utils_Type
::T_BOOLEAN
,
365 'title' => ts('Price Field Is Active?'),
366 'description' => ts('Is this price field active'),
367 'where' => 'civicrm_price_field.is_active',
369 'table_name' => 'civicrm_price_field',
370 'entity' => 'PriceField',
371 'bao' => 'CRM_Price_BAO_PriceField',
374 'type' => 'CheckBox',
378 'name' => 'is_required',
379 'type' => CRM_Utils_Type
::T_BOOLEAN
,
380 'title' => ts('Price Field is Required?'),
381 'description' => ts('Is this price field required (value must be > 1)'),
382 'where' => 'civicrm_price_field.is_required',
384 'table_name' => 'civicrm_price_field',
385 'entity' => 'PriceField',
386 'bao' => 'CRM_Price_BAO_PriceField',
389 'type' => 'CheckBox',
393 'name' => 'active_on',
394 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
395 'title' => ts('Price Field Start Date'),
396 'description' => ts('If non-zero, do not show this field before the date specified'),
397 'where' => 'civicrm_price_field.active_on',
399 'table_name' => 'civicrm_price_field',
400 'entity' => 'PriceField',
401 'bao' => 'CRM_Price_BAO_PriceField',
404 'type' => 'Select Date',
405 'formatType' => 'activityDateTime',
409 'name' => 'expire_on',
410 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
411 'title' => ts('Price Field End Date'),
412 'description' => ts('If non-zero, do not show this field after the date specified'),
413 'where' => 'civicrm_price_field.expire_on',
415 'table_name' => 'civicrm_price_field',
416 'entity' => 'PriceField',
417 'bao' => 'CRM_Price_BAO_PriceField',
420 'type' => 'Select Date',
421 'formatType' => 'activityDateTime',
425 'name' => 'javascript',
426 'type' => CRM_Utils_Type
::T_STRING
,
427 'title' => ts('Price Field Javascript'),
428 'description' => ts('Optional scripting attributes for field'),
430 'size' => CRM_Utils_Type
::HUGE
,
431 'where' => 'civicrm_price_field.javascript',
432 'table_name' => 'civicrm_price_field',
433 'entity' => 'PriceField',
434 'bao' => 'CRM_Price_BAO_PriceField',
441 'name' => 'visibility_id',
442 'type' => CRM_Utils_Type
::T_INT
,
443 'title' => ts('Price Field Visibility'),
444 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
445 'where' => 'civicrm_price_field.visibility_id',
447 'table_name' => 'civicrm_price_field',
448 'entity' => 'PriceField',
449 'bao' => 'CRM_Price_BAO_PriceField',
454 'pseudoconstant' => [
455 'optionGroupName' => 'visibility',
456 'optionEditPath' => 'civicrm/admin/options/visibility',
460 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
462 return Civi
::$statics[__CLASS__
]['fields'];
466 * Return a mapping from field-name to the corresponding key (as used in fields()).
469 * Array(string $name => string $uniqueName).
471 public static function &fieldKeys() {
472 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
473 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
475 return Civi
::$statics[__CLASS__
]['fieldKeys'];
479 * Returns the names of this table
483 public static function getTableName() {
484 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
488 * Returns if this table needs to be logged
492 public function getLog() {
497 * Returns the list of fields that can be imported
499 * @param bool $prefix
503 public static function &import($prefix = FALSE) {
504 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
509 * Returns the list of fields that can be exported
511 * @param bool $prefix
515 public static function &export($prefix = FALSE) {
516 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
521 * Returns the list of indices
523 * @param bool $localize
527 public static function indices($localize = TRUE) {
530 'name' => 'index_name',
534 'localizable' => FALSE,
535 'sig' => 'civicrm_price_field::0::name',
538 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;