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:935483d60be1711ca878bba629e3f00b)
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',
185 'name' => 'domain_id',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Domain ID'),
188 'description' => ts('Which Domain is this price-set for'),
189 'where' => 'civicrm_price_set.domain_id',
190 'table_name' => 'civicrm_price_set',
191 'entity' => 'PriceSet',
192 'bao' => 'CRM_Price_BAO_PriceSet',
194 'FKClassName' => 'CRM_Core_DAO_Domain',
197 'label' => ts("Domain"),
199 'pseudoconstant' => [
200 'table' => 'civicrm_domain',
202 'labelColumn' => 'name',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Name'),
210 'description' => ts('Variable name/programmatic handle for this set of price fields.'),
213 'size' => CRM_Utils_Type
::HUGE
,
214 'where' => 'civicrm_price_set.name',
215 'table_name' => 'civicrm_price_set',
216 'entity' => 'PriceSet',
217 'bao' => 'CRM_Price_BAO_PriceSet',
221 'label' => ts("Name"),
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Price Set Title'),
229 'description' => ts('Displayed title for the Price Set.'),
232 'size' => CRM_Utils_Type
::HUGE
,
233 'where' => 'civicrm_price_set.title',
234 'table_name' => 'civicrm_price_set',
235 'entity' => 'PriceSet',
236 'bao' => 'CRM_Price_BAO_PriceSet',
244 'name' => 'is_active',
245 'type' => CRM_Utils_Type
::T_BOOLEAN
,
246 'title' => ts('Price Set Is Active?'),
247 'description' => ts('Is this price set active'),
248 'where' => 'civicrm_price_set.is_active',
250 'table_name' => 'civicrm_price_set',
251 'entity' => 'PriceSet',
252 'bao' => 'CRM_Price_BAO_PriceSet',
255 'type' => 'CheckBox',
260 'name' => 'help_pre',
261 'type' => CRM_Utils_Type
::T_TEXT
,
262 'title' => ts('Price Set Pre Help'),
263 'description' => ts('Description and/or help text to display before fields in form.'),
266 'where' => 'civicrm_price_set.help_pre',
267 'table_name' => 'civicrm_price_set',
268 'entity' => 'PriceSet',
269 'bao' => 'CRM_Price_BAO_PriceSet',
272 'type' => 'TextArea',
277 'name' => 'help_post',
278 'type' => CRM_Utils_Type
::T_TEXT
,
279 'title' => ts('Price Set Post Help'),
280 'description' => ts('Description and/or help text to display after fields in form.'),
283 'where' => 'civicrm_price_set.help_post',
284 'table_name' => 'civicrm_price_set',
285 'entity' => 'PriceSet',
286 'bao' => 'CRM_Price_BAO_PriceSet',
289 'type' => 'TextArea',
294 'name' => 'javascript',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('Price Set Javascript'),
297 'description' => ts('Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'),
299 'size' => CRM_Utils_Type
::BIG
,
300 'where' => 'civicrm_price_set.javascript',
301 'table_name' => 'civicrm_price_set',
302 'entity' => 'PriceSet',
303 'bao' => 'CRM_Price_BAO_PriceSet',
312 'type' => CRM_Utils_Type
::T_STRING
,
313 'title' => ts('Price Set Extends'),
314 'description' => ts('What components are using this price set?'),
317 'size' => CRM_Utils_Type
::HUGE
,
318 'where' => 'civicrm_price_set.extends',
319 'table_name' => 'civicrm_price_set',
320 'entity' => 'PriceSet',
321 'bao' => 'CRM_Price_BAO_PriceSet',
326 'pseudoconstant' => [
327 'table' => 'civicrm_component',
329 'labelColumn' => 'name',
333 'financial_type_id' => [
334 'name' => 'financial_type_id',
335 'type' => CRM_Utils_Type
::T_INT
,
336 'title' => ts('Financial Type ID'),
337 'description' => ts('FK to Financial Type(for membership price sets only).'),
338 'where' => 'civicrm_price_set.financial_type_id',
340 'table_name' => 'civicrm_price_set',
341 'entity' => 'PriceSet',
342 'bao' => 'CRM_Price_BAO_PriceSet',
344 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
347 'label' => ts("Financial Type"),
349 'pseudoconstant' => [
350 'table' => 'civicrm_financial_type',
352 'labelColumn' => 'name',
356 'is_quick_config' => [
357 'name' => 'is_quick_config',
358 'type' => CRM_Utils_Type
::T_BOOLEAN
,
359 'title' => ts('Is Price Set Quick Config?'),
360 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'),
361 'where' => 'civicrm_price_set.is_quick_config',
363 'table_name' => 'civicrm_price_set',
364 'entity' => 'PriceSet',
365 'bao' => 'CRM_Price_BAO_PriceSet',
368 'type' => 'CheckBox',
373 'name' => 'is_reserved',
374 'type' => CRM_Utils_Type
::T_BOOLEAN
,
375 'title' => ts('Price Set Is Reserved'),
376 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'),
377 'where' => 'civicrm_price_set.is_reserved',
379 'table_name' => 'civicrm_price_set',
380 'entity' => 'PriceSet',
381 'bao' => 'CRM_Price_BAO_PriceSet',
384 'type' => 'CheckBox',
389 'name' => 'min_amount',
390 'type' => CRM_Utils_Type
::T_MONEY
,
391 'title' => ts('Minimum Amount'),
392 'description' => ts('Minimum Amount required for this set.'),
397 'where' => 'civicrm_price_set.min_amount',
399 'table_name' => 'civicrm_price_set',
400 'entity' => 'PriceSet',
401 'bao' => 'CRM_Price_BAO_PriceSet',
409 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
411 return Civi
::$statics[__CLASS__
]['fields'];
415 * Return a mapping from field-name to the corresponding key (as used in fields()).
418 * Array(string $name => string $uniqueName).
420 public static function &fieldKeys() {
421 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
422 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
424 return Civi
::$statics[__CLASS__
]['fieldKeys'];
428 * Returns the names of this table
432 public static function getTableName() {
433 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
437 * Returns if this table needs to be logged
441 public function getLog() {
446 * Returns the list of fields that can be imported
448 * @param bool $prefix
452 public static function &import($prefix = FALSE) {
453 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_set', $prefix, []);
458 * Returns the list of fields that can be exported
460 * @param bool $prefix
464 public static function &export($prefix = FALSE) {
465 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_set', $prefix, []);
470 * Returns the list of indices
472 * @param bool $localize
476 public static function indices($localize = TRUE) {
483 'localizable' => FALSE,
485 'sig' => 'civicrm_price_set::1::name',
488 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;