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:da319316754e17cc5f9447c9e2b095ad)
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',
184 'name' => 'domain_id',
185 'type' => CRM_Utils_Type
::T_INT
,
186 'title' => ts('Domain ID'),
187 'description' => ts('Which Domain is this price-set for'),
188 'where' => 'civicrm_price_set.domain_id',
189 'table_name' => 'civicrm_price_set',
190 'entity' => 'PriceSet',
191 'bao' => 'CRM_Price_BAO_PriceSet',
193 'FKClassName' => 'CRM_Core_DAO_Domain',
196 'label' => ts("Domain"),
198 'pseudoconstant' => [
199 'table' => 'civicrm_domain',
201 'labelColumn' => 'name',
207 'type' => CRM_Utils_Type
::T_STRING
,
208 'title' => ts('Name'),
209 'description' => ts('Variable name/programmatic handle for this set of price fields.'),
212 'size' => CRM_Utils_Type
::HUGE
,
213 'where' => 'civicrm_price_set.name',
214 'table_name' => 'civicrm_price_set',
215 'entity' => 'PriceSet',
216 'bao' => 'CRM_Price_BAO_PriceSet',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Price Set Title'),
227 'description' => ts('Displayed title for the Price Set.'),
230 'size' => CRM_Utils_Type
::HUGE
,
231 'where' => 'civicrm_price_set.title',
232 'table_name' => 'civicrm_price_set',
233 'entity' => 'PriceSet',
234 'bao' => 'CRM_Price_BAO_PriceSet',
242 'name' => 'is_active',
243 'type' => CRM_Utils_Type
::T_BOOLEAN
,
244 'title' => ts('Price Set Is Active?'),
245 'description' => ts('Is this price set active'),
246 'where' => 'civicrm_price_set.is_active',
248 'table_name' => 'civicrm_price_set',
249 'entity' => 'PriceSet',
250 'bao' => 'CRM_Price_BAO_PriceSet',
253 'type' => 'CheckBox',
258 'name' => 'help_pre',
259 'type' => CRM_Utils_Type
::T_TEXT
,
260 'title' => ts('Price Set Pre Help'),
261 'description' => ts('Description and/or help text to display before fields in form.'),
264 'where' => 'civicrm_price_set.help_pre',
265 'table_name' => 'civicrm_price_set',
266 'entity' => 'PriceSet',
267 'bao' => 'CRM_Price_BAO_PriceSet',
270 'type' => 'TextArea',
275 'name' => 'help_post',
276 'type' => CRM_Utils_Type
::T_TEXT
,
277 'title' => ts('Price Set Post Help'),
278 'description' => ts('Description and/or help text to display after fields in form.'),
281 'where' => 'civicrm_price_set.help_post',
282 'table_name' => 'civicrm_price_set',
283 'entity' => 'PriceSet',
284 'bao' => 'CRM_Price_BAO_PriceSet',
287 'type' => 'TextArea',
292 'name' => 'javascript',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Price Set Javascript'),
295 'description' => ts('Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'),
297 'size' => CRM_Utils_Type
::BIG
,
298 'where' => 'civicrm_price_set.javascript',
299 'table_name' => 'civicrm_price_set',
300 'entity' => 'PriceSet',
301 'bao' => 'CRM_Price_BAO_PriceSet',
310 'type' => CRM_Utils_Type
::T_STRING
,
311 'title' => ts('Price Set Extends'),
312 'description' => ts('What components are using this price set?'),
315 'size' => CRM_Utils_Type
::HUGE
,
316 'where' => 'civicrm_price_set.extends',
317 'table_name' => 'civicrm_price_set',
318 'entity' => 'PriceSet',
319 'bao' => 'CRM_Price_BAO_PriceSet',
324 'pseudoconstant' => [
325 'table' => 'civicrm_component',
327 'labelColumn' => 'name',
331 'financial_type_id' => [
332 'name' => 'financial_type_id',
333 'type' => CRM_Utils_Type
::T_INT
,
334 'title' => ts('Financial Type ID'),
335 'description' => ts('FK to Financial Type(for membership price sets only).'),
336 'where' => 'civicrm_price_set.financial_type_id',
338 'table_name' => 'civicrm_price_set',
339 'entity' => 'PriceSet',
340 'bao' => 'CRM_Price_BAO_PriceSet',
342 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
345 'label' => ts("Financial Type"),
347 'pseudoconstant' => [
348 'table' => 'civicrm_financial_type',
350 'labelColumn' => 'name',
354 'is_quick_config' => [
355 'name' => 'is_quick_config',
356 'type' => CRM_Utils_Type
::T_BOOLEAN
,
357 'title' => ts('Is Price Set Quick Config?'),
358 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'),
359 'where' => 'civicrm_price_set.is_quick_config',
361 'table_name' => 'civicrm_price_set',
362 'entity' => 'PriceSet',
363 'bao' => 'CRM_Price_BAO_PriceSet',
366 'type' => 'CheckBox',
371 'name' => 'is_reserved',
372 'type' => CRM_Utils_Type
::T_BOOLEAN
,
373 'title' => ts('Price Set Is Reserved'),
374 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'),
375 'where' => 'civicrm_price_set.is_reserved',
377 'table_name' => 'civicrm_price_set',
378 'entity' => 'PriceSet',
379 'bao' => 'CRM_Price_BAO_PriceSet',
382 'type' => 'CheckBox',
387 'name' => 'min_amount',
388 'type' => CRM_Utils_Type
::T_MONEY
,
389 'title' => ts('Minimum Amount'),
390 'description' => ts('Minimum Amount required for this set.'),
395 'where' => 'civicrm_price_set.min_amount',
397 'table_name' => 'civicrm_price_set',
398 'entity' => 'PriceSet',
399 'bao' => 'CRM_Price_BAO_PriceSet',
407 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
409 return Civi
::$statics[__CLASS__
]['fields'];
413 * Return a mapping from field-name to the corresponding key (as used in fields()).
416 * Array(string $name => string $uniqueName).
418 public static function &fieldKeys() {
419 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
420 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
422 return Civi
::$statics[__CLASS__
]['fieldKeys'];
426 * Returns the names of this table
430 public static function getTableName() {
431 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
435 * Returns if this table needs to be logged
439 public function getLog() {
444 * Returns the list of fields that can be imported
446 * @param bool $prefix
450 public static function &import($prefix = FALSE) {
451 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_set', $prefix, []);
456 * Returns the list of fields that can be exported
458 * @param bool $prefix
462 public static function &export($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_set', $prefix, []);
468 * Returns the list of indices
470 * @param bool $localize
474 public static function indices($localize = TRUE) {
481 'localizable' => FALSE,
483 'sig' => 'civicrm_price_set::1::name',
486 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;