5 * @copyright CiviCRM LLC (c) 2004-2017
7 * Generated from xml/schema/CRM/Price/PriceField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:6ee89c3106c27af4ca96897826a2ef8c)
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 static $_tableName = 'civicrm_price_field';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'Price Field',
185 'table_name' => 'civicrm_price_field',
186 'entity' => 'PriceField',
187 'bao' => 'CRM_Price_BAO_PriceField',
191 'name' => 'price_set_id',
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('Price Set'),
194 'description' => 'FK to civicrm_price_set',
196 'table_name' => 'civicrm_price_field',
197 'entity' => 'PriceField',
198 'bao' => 'CRM_Price_BAO_PriceField',
200 'FKClassName' => 'CRM_Price_DAO_PriceSet',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Name'),
206 'description' => 'Variable name/programmatic handle for this field.',
209 'size' => CRM_Utils_Type
::HUGE
,
210 'table_name' => 'civicrm_price_field',
211 'entity' => 'PriceField',
212 'bao' => 'CRM_Price_BAO_PriceField',
220 'type' => CRM_Utils_Type
::T_STRING
,
221 'title' => ts('Label'),
222 'description' => 'Text for form field label (also friendly name for administering this field).',
225 'size' => CRM_Utils_Type
::HUGE
,
226 'table_name' => 'civicrm_price_field',
227 'entity' => 'PriceField',
228 'bao' => 'CRM_Price_BAO_PriceField',
235 'name' => 'html_type',
236 'type' => CRM_Utils_Type
::T_STRING
,
237 'title' => ts('Html Type'),
240 'size' => CRM_Utils_Type
::TWELVE
,
241 'table_name' => 'civicrm_price_field',
242 'entity' => 'PriceField',
243 'bao' => 'CRM_Price_BAO_PriceField',
248 'pseudoconstant' => [
249 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
253 'name' => 'is_enter_qty',
254 'type' => CRM_Utils_Type
::T_BOOLEAN
,
255 'title' => ts('Price Field Quantity Required?'),
256 'description' => 'Enter a quantity for this field?',
257 'table_name' => 'civicrm_price_field',
258 'entity' => 'PriceField',
259 'bao' => 'CRM_Price_BAO_PriceField',
262 'type' => 'CheckBox',
266 'name' => 'help_pre',
267 'type' => CRM_Utils_Type
::T_TEXT
,
268 'title' => ts('Price Field Pre Text'),
269 'description' => 'Description and/or help text to display before this field.',
272 'table_name' => 'civicrm_price_field',
273 'entity' => 'PriceField',
274 'bao' => 'CRM_Price_BAO_PriceField',
277 'type' => 'TextArea',
281 'name' => 'help_post',
282 'type' => CRM_Utils_Type
::T_TEXT
,
283 'title' => ts('Price Field Post Text'),
284 'description' => 'Description and/or help text to display after this field.',
287 'table_name' => 'civicrm_price_field',
288 'entity' => 'PriceField',
289 'bao' => 'CRM_Price_BAO_PriceField',
292 'type' => 'TextArea',
297 'type' => CRM_Utils_Type
::T_INT
,
298 'title' => ts('Order'),
299 'description' => 'Order in which the fields should appear',
301 'table_name' => 'civicrm_price_field',
302 'entity' => 'PriceField',
303 'bao' => 'CRM_Price_BAO_PriceField',
309 'is_display_amounts' => [
310 'name' => 'is_display_amounts',
311 'type' => CRM_Utils_Type
::T_BOOLEAN
,
312 'title' => ts('Price Field Show Amounts?'),
313 'description' => 'Should the price be displayed next to the label for each option?',
315 'table_name' => 'civicrm_price_field',
316 'entity' => 'PriceField',
317 'bao' => 'CRM_Price_BAO_PriceField',
320 'type' => 'CheckBox',
323 'options_per_line' => [
324 'name' => 'options_per_line',
325 'type' => CRM_Utils_Type
::T_INT
,
326 'title' => ts('Price Field Options per Row'),
327 'description' => 'number of options per line for checkbox and radio',
329 'table_name' => 'civicrm_price_field',
330 'entity' => 'PriceField',
331 'bao' => 'CRM_Price_BAO_PriceField',
338 'name' => 'is_active',
339 'type' => CRM_Utils_Type
::T_BOOLEAN
,
340 'title' => ts('Price Field Is Active?'),
341 'description' => 'Is this price field active',
343 'table_name' => 'civicrm_price_field',
344 'entity' => 'PriceField',
345 'bao' => 'CRM_Price_BAO_PriceField',
348 'type' => 'CheckBox',
352 'name' => 'is_required',
353 'type' => CRM_Utils_Type
::T_BOOLEAN
,
354 'title' => ts('Price Field is Required?'),
355 'description' => 'Is this price field required (value must be > 1)',
357 'table_name' => 'civicrm_price_field',
358 'entity' => 'PriceField',
359 'bao' => 'CRM_Price_BAO_PriceField',
362 'type' => 'CheckBox',
366 'name' => 'active_on',
367 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
368 'title' => ts('Price Field Start Date'),
369 'description' => 'If non-zero, do not show this field before the date specified',
371 'table_name' => 'civicrm_price_field',
372 'entity' => 'PriceField',
373 'bao' => 'CRM_Price_BAO_PriceField',
376 'type' => 'CheckBox',
380 'name' => 'expire_on',
381 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
382 'title' => ts('Price Field End Date'),
383 'description' => 'If non-zero, do not show this field after the date specified',
385 'table_name' => 'civicrm_price_field',
386 'entity' => 'PriceField',
387 'bao' => 'CRM_Price_BAO_PriceField',
390 'type' => 'Select Date',
394 'name' => 'javascript',
395 'type' => CRM_Utils_Type
::T_STRING
,
396 'title' => ts('Price Field Javascript'),
397 'description' => 'Optional scripting attributes for field',
399 'size' => CRM_Utils_Type
::HUGE
,
400 'table_name' => 'civicrm_price_field',
401 'entity' => 'PriceField',
402 'bao' => 'CRM_Price_BAO_PriceField',
409 'name' => 'visibility_id',
410 'type' => CRM_Utils_Type
::T_INT
,
411 'title' => ts('Price Field Visibility'),
412 'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'',
414 'table_name' => 'civicrm_price_field',
415 'entity' => 'PriceField',
416 'bao' => 'CRM_Price_BAO_PriceField',
421 'pseudoconstant' => [
422 'optionGroupName' => 'visibility',
423 'optionEditPath' => 'civicrm/admin/options/visibility',
427 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
429 return Civi
::$statics[__CLASS__
]['fields'];
433 * Return a mapping from field-name to the corresponding key (as used in fields()).
436 * Array(string $name => string $uniqueName).
438 public static function &fieldKeys() {
439 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
440 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
442 return Civi
::$statics[__CLASS__
]['fieldKeys'];
446 * Returns the names of this table
450 public static function getTableName() {
451 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
455 * Returns if this table needs to be logged
459 public function getLog() {
464 * Returns the list of fields that can be imported
466 * @param bool $prefix
470 public static function &import($prefix = FALSE) {
471 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field', $prefix, []);
476 * Returns the list of fields that can be exported
478 * @param bool $prefix
482 public static function &export($prefix = FALSE) {
483 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field', $prefix, []);
488 * Returns the list of indices
490 * @param bool $localize
494 public static function indices($localize = TRUE) {
497 'name' => 'index_name',
501 'localizable' => FALSE,
502 'sig' => 'civicrm_price_field::0::name',
505 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;