5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Price/PriceSet.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:39c1c8ba7a9eb2ea10fbc216fd22ca23)
13 * Database access object for the PriceSet entity.
15 class CRM_Price_DAO_PriceSet
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_set';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * Which Domain is this price-set for
49 * Variable name/programmatic handle for this set of price fields.
56 * Displayed title for the Price Set.
63 * Is this price set active
70 * Description and/or help text to display before fields in form.
77 * Description and/or help text to display after fields in form.
84 * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
91 * What components are using this price set?
98 * FK to Financial Type(for membership price sets only).
102 public $financial_type_id;
105 * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
109 public $is_quick_config;
112 * Is this a predefined system price set (i.e. it can not be deleted, edited)?
119 * Minimum Amount required for this set.
128 public function __construct() {
129 $this->__table
= 'civicrm_price_set';
130 parent
::__construct();
134 * Returns localized title of this entity.
136 * @param bool $plural
137 * Whether to return the plural version of the title.
139 public static function getEntityTitle($plural = FALSE) {
140 return $plural ?
ts('Price Sets') : ts('Price Set');
144 * Returns foreign keys and entity references.
147 * [CRM_Core_Reference_Interface]
149 public static function getReferenceColumns() {
150 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
151 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
152 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
153 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
154 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
156 return Civi
::$statics[__CLASS__
]['links'];
160 * Returns all the column names of this table
164 public static function &fields() {
165 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
166 Civi
::$statics[__CLASS__
]['fields'] = [
169 'type' => CRM_Utils_Type
::T_INT
,
170 'title' => ts('Price Set'),
171 'description' => ts('Price Set'),
173 'where' => 'civicrm_price_set.id',
174 'table_name' => 'civicrm_price_set',
175 'entity' => 'PriceSet',
176 'bao' => 'CRM_Price_BAO_PriceSet',
186 'name' => 'domain_id',
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Domain ID'),
189 'description' => ts('Which Domain is this price-set for'),
190 'where' => 'civicrm_price_set.domain_id',
191 'table_name' => 'civicrm_price_set',
192 'entity' => 'PriceSet',
193 'bao' => 'CRM_Price_BAO_PriceSet',
195 'FKClassName' => 'CRM_Core_DAO_Domain',
198 'label' => ts("Domain"),
200 'pseudoconstant' => [
201 'table' => 'civicrm_domain',
203 'labelColumn' => 'name',
209 'type' => CRM_Utils_Type
::T_STRING
,
210 'title' => ts('Name'),
211 'description' => ts('Variable name/programmatic handle for this set of price fields.'),
214 'size' => CRM_Utils_Type
::HUGE
,
215 'where' => 'civicrm_price_set.name',
216 'table_name' => 'civicrm_price_set',
217 'entity' => 'PriceSet',
218 'bao' => 'CRM_Price_BAO_PriceSet',
222 'label' => ts("Name"),
228 'type' => CRM_Utils_Type
::T_STRING
,
229 'title' => ts('Price Set Title'),
230 'description' => ts('Displayed title for the Price Set.'),
233 'size' => CRM_Utils_Type
::HUGE
,
234 'where' => 'civicrm_price_set.title',
235 'table_name' => 'civicrm_price_set',
236 'entity' => 'PriceSet',
237 'bao' => 'CRM_Price_BAO_PriceSet',
245 'name' => 'is_active',
246 'type' => CRM_Utils_Type
::T_BOOLEAN
,
247 'title' => ts('Price Set Is Active?'),
248 'description' => ts('Is this price set active'),
249 'where' => 'civicrm_price_set.is_active',
251 'table_name' => 'civicrm_price_set',
252 'entity' => 'PriceSet',
253 'bao' => 'CRM_Price_BAO_PriceSet',
256 'type' => 'CheckBox',
261 'name' => 'help_pre',
262 'type' => CRM_Utils_Type
::T_TEXT
,
263 'title' => ts('Price Set Pre Help'),
264 'description' => ts('Description and/or help text to display before fields in form.'),
267 'where' => 'civicrm_price_set.help_pre',
268 'table_name' => 'civicrm_price_set',
269 'entity' => 'PriceSet',
270 'bao' => 'CRM_Price_BAO_PriceSet',
273 'type' => 'TextArea',
278 'name' => 'help_post',
279 'type' => CRM_Utils_Type
::T_TEXT
,
280 'title' => ts('Price Set Post Help'),
281 'description' => ts('Description and/or help text to display after fields in form.'),
284 'where' => 'civicrm_price_set.help_post',
285 'table_name' => 'civicrm_price_set',
286 'entity' => 'PriceSet',
287 'bao' => 'CRM_Price_BAO_PriceSet',
290 'type' => 'TextArea',
295 'name' => 'javascript',
296 'type' => CRM_Utils_Type
::T_STRING
,
297 'title' => ts('Price Set Javascript'),
298 'description' => ts('Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'),
300 'size' => CRM_Utils_Type
::BIG
,
301 'where' => 'civicrm_price_set.javascript',
302 'table_name' => 'civicrm_price_set',
303 'entity' => 'PriceSet',
304 'bao' => 'CRM_Price_BAO_PriceSet',
313 'type' => CRM_Utils_Type
::T_STRING
,
314 'title' => ts('Price Set Extends'),
315 'description' => ts('What components are using this price set?'),
318 'size' => CRM_Utils_Type
::HUGE
,
319 'where' => 'civicrm_price_set.extends',
320 'table_name' => 'civicrm_price_set',
321 'entity' => 'PriceSet',
322 'bao' => 'CRM_Price_BAO_PriceSet',
327 'pseudoconstant' => [
328 'table' => 'civicrm_component',
330 'labelColumn' => 'name',
334 'financial_type_id' => [
335 'name' => 'financial_type_id',
336 'type' => CRM_Utils_Type
::T_INT
,
337 'title' => ts('Financial Type ID'),
338 'description' => ts('FK to Financial Type(for membership price sets only).'),
339 'where' => 'civicrm_price_set.financial_type_id',
341 'table_name' => 'civicrm_price_set',
342 'entity' => 'PriceSet',
343 'bao' => 'CRM_Price_BAO_PriceSet',
345 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
348 'label' => ts("Financial Type"),
350 'pseudoconstant' => [
351 'table' => 'civicrm_financial_type',
353 'labelColumn' => 'name',
357 'is_quick_config' => [
358 'name' => 'is_quick_config',
359 'type' => CRM_Utils_Type
::T_BOOLEAN
,
360 'title' => ts('Is Price Set Quick Config?'),
361 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'),
362 'where' => 'civicrm_price_set.is_quick_config',
364 'table_name' => 'civicrm_price_set',
365 'entity' => 'PriceSet',
366 'bao' => 'CRM_Price_BAO_PriceSet',
369 'type' => 'CheckBox',
374 'name' => 'is_reserved',
375 'type' => CRM_Utils_Type
::T_BOOLEAN
,
376 'title' => ts('Price Set Is Reserved'),
377 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'),
378 'where' => 'civicrm_price_set.is_reserved',
380 'table_name' => 'civicrm_price_set',
381 'entity' => 'PriceSet',
382 'bao' => 'CRM_Price_BAO_PriceSet',
385 'type' => 'CheckBox',
390 'name' => 'min_amount',
391 'type' => CRM_Utils_Type
::T_MONEY
,
392 'title' => ts('Minimum Amount'),
393 'description' => ts('Minimum Amount required for this set.'),
398 'where' => 'civicrm_price_set.min_amount',
400 'table_name' => 'civicrm_price_set',
401 'entity' => 'PriceSet',
402 'bao' => 'CRM_Price_BAO_PriceSet',
410 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
412 return Civi
::$statics[__CLASS__
]['fields'];
416 * Return a mapping from field-name to the corresponding key (as used in fields()).
419 * Array(string $name => string $uniqueName).
421 public static function &fieldKeys() {
422 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
423 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
425 return Civi
::$statics[__CLASS__
]['fieldKeys'];
429 * Returns the names of this table
433 public static function getTableName() {
434 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
438 * Returns if this table needs to be logged
442 public function getLog() {
447 * Returns the list of fields that can be imported
449 * @param bool $prefix
453 public static function &import($prefix = FALSE) {
454 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_set', $prefix, []);
459 * Returns the list of fields that can be exported
461 * @param bool $prefix
465 public static function &export($prefix = FALSE) {
466 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_set', $prefix, []);
471 * Returns the list of indices
473 * @param bool $localize
477 public static function indices($localize = TRUE) {
484 'localizable' => FALSE,
486 'sig' => 'civicrm_price_set::1::name',
489 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;