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:4fe369dcc2eb277bdbb04d52be2d4a55)
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('Price Set Domain'),
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',
197 'pseudoconstant' => [
198 'table' => 'civicrm_domain',
200 'labelColumn' => 'name',
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Name'),
208 'description' => ts('Variable name/programmatic handle for this set of price fields.'),
211 'size' => CRM_Utils_Type
::HUGE
,
212 'where' => 'civicrm_price_set.name',
213 'table_name' => 'civicrm_price_set',
214 'entity' => 'PriceSet',
215 'bao' => 'CRM_Price_BAO_PriceSet',
224 'type' => CRM_Utils_Type
::T_STRING
,
225 'title' => ts('Price Set Title'),
226 'description' => ts('Displayed title for the Price Set.'),
229 'size' => CRM_Utils_Type
::HUGE
,
230 'where' => 'civicrm_price_set.title',
231 'table_name' => 'civicrm_price_set',
232 'entity' => 'PriceSet',
233 'bao' => 'CRM_Price_BAO_PriceSet',
241 'name' => 'is_active',
242 'type' => CRM_Utils_Type
::T_BOOLEAN
,
243 'title' => ts('Price Set Is Active?'),
244 'description' => ts('Is this price set active'),
245 'where' => 'civicrm_price_set.is_active',
247 'table_name' => 'civicrm_price_set',
248 'entity' => 'PriceSet',
249 'bao' => 'CRM_Price_BAO_PriceSet',
252 'type' => 'CheckBox',
257 'name' => 'help_pre',
258 'type' => CRM_Utils_Type
::T_TEXT
,
259 'title' => ts('Price Set Pre Help'),
260 'description' => ts('Description and/or help text to display before fields in form.'),
263 'where' => 'civicrm_price_set.help_pre',
264 'table_name' => 'civicrm_price_set',
265 'entity' => 'PriceSet',
266 'bao' => 'CRM_Price_BAO_PriceSet',
269 'type' => 'TextArea',
274 'name' => 'help_post',
275 'type' => CRM_Utils_Type
::T_TEXT
,
276 'title' => ts('Price Set Post Help'),
277 'description' => ts('Description and/or help text to display after fields in form.'),
280 'where' => 'civicrm_price_set.help_post',
281 'table_name' => 'civicrm_price_set',
282 'entity' => 'PriceSet',
283 'bao' => 'CRM_Price_BAO_PriceSet',
286 'type' => 'TextArea',
291 'name' => 'javascript',
292 'type' => CRM_Utils_Type
::T_STRING
,
293 'title' => ts('Price Set Javascript'),
294 'description' => ts('Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'),
296 'size' => CRM_Utils_Type
::BIG
,
297 'where' => 'civicrm_price_set.javascript',
298 'table_name' => 'civicrm_price_set',
299 'entity' => 'PriceSet',
300 'bao' => 'CRM_Price_BAO_PriceSet',
309 'type' => CRM_Utils_Type
::T_STRING
,
310 'title' => ts('Price Set Extends'),
311 'description' => ts('What components are using this price set?'),
314 'size' => CRM_Utils_Type
::HUGE
,
315 'where' => 'civicrm_price_set.extends',
316 'table_name' => 'civicrm_price_set',
317 'entity' => 'PriceSet',
318 'bao' => 'CRM_Price_BAO_PriceSet',
323 'pseudoconstant' => [
324 'table' => 'civicrm_component',
326 'labelColumn' => 'name',
330 'financial_type_id' => [
331 'name' => 'financial_type_id',
332 'type' => CRM_Utils_Type
::T_INT
,
333 'title' => ts('Financial Type'),
334 'description' => ts('FK to Financial Type(for membership price sets only).'),
335 'where' => 'civicrm_price_set.financial_type_id',
337 'table_name' => 'civicrm_price_set',
338 'entity' => 'PriceSet',
339 'bao' => 'CRM_Price_BAO_PriceSet',
341 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
345 'pseudoconstant' => [
346 'table' => 'civicrm_financial_type',
348 'labelColumn' => 'name',
352 'is_quick_config' => [
353 'name' => 'is_quick_config',
354 'type' => CRM_Utils_Type
::T_BOOLEAN
,
355 'title' => ts('Is Price Set Quick Config?'),
356 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'),
357 'where' => 'civicrm_price_set.is_quick_config',
359 'table_name' => 'civicrm_price_set',
360 'entity' => 'PriceSet',
361 'bao' => 'CRM_Price_BAO_PriceSet',
364 'type' => 'CheckBox',
369 'name' => 'is_reserved',
370 'type' => CRM_Utils_Type
::T_BOOLEAN
,
371 'title' => ts('Price Set Is Reserved'),
372 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'),
373 'where' => 'civicrm_price_set.is_reserved',
375 'table_name' => 'civicrm_price_set',
376 'entity' => 'PriceSet',
377 'bao' => 'CRM_Price_BAO_PriceSet',
380 'type' => 'CheckBox',
385 'name' => 'min_amount',
386 'type' => CRM_Utils_Type
::T_MONEY
,
387 'title' => ts('Minimum Amount'),
388 'description' => ts('Minimum Amount required for this set.'),
393 'where' => 'civicrm_price_set.min_amount',
395 'table_name' => 'civicrm_price_set',
396 'entity' => 'PriceSet',
397 'bao' => 'CRM_Price_BAO_PriceSet',
405 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
407 return Civi
::$statics[__CLASS__
]['fields'];
411 * Return a mapping from field-name to the corresponding key (as used in fields()).
414 * Array(string $name => string $uniqueName).
416 public static function &fieldKeys() {
417 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
418 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
420 return Civi
::$statics[__CLASS__
]['fieldKeys'];
424 * Returns the names of this table
428 public static function getTableName() {
429 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
433 * Returns if this table needs to be logged
437 public function getLog() {
442 * Returns the list of fields that can be imported
444 * @param bool $prefix
448 public static function &import($prefix = FALSE) {
449 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_set', $prefix, []);
454 * Returns the list of fields that can be exported
456 * @param bool $prefix
460 public static function &export($prefix = FALSE) {
461 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_set', $prefix, []);
466 * Returns the list of indices
468 * @param bool $localize
472 public static function indices($localize = TRUE) {
479 'localizable' => FALSE,
481 'sig' => 'civicrm_price_set::1::name',
484 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;