5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Price/PriceSet.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1d56df0faf4b450b98f2e39f3922f87c)
13 * Database access object for the PriceSet entity.
15 class CRM_Price_DAO_PriceSet
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_price_set';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Which Domain is this price-set for
46 * Variable name/programmatic handle for this set of price fields.
53 * Displayed title for the Price Set.
60 * Is this price set active
67 * Description and/or help text to display before fields in form.
74 * Description and/or help text to display after fields in form.
81 * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
88 * What components are using this price set?
95 * FK to Financial Type(for membership price sets only).
99 public $financial_type_id;
102 * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
106 public $is_quick_config;
109 * Is this a predefined system price set (i.e. it can not be deleted, edited)?
116 * Minimum Amount required for this set.
125 public function __construct() {
126 $this->__table
= 'civicrm_price_set';
127 parent
::__construct();
131 * Returns foreign keys and entity references.
134 * [CRM_Core_Reference_Interface]
136 public static function getReferenceColumns() {
137 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
138 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
139 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
140 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
141 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
143 return Civi
::$statics[__CLASS__
]['links'];
147 * Returns all the column names of this table
151 public static function &fields() {
152 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
153 Civi
::$statics[__CLASS__
]['fields'] = [
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Price Set ID'),
158 'description' => ts('Price Set'),
160 'where' => 'civicrm_price_set.id',
161 'table_name' => 'civicrm_price_set',
162 'entity' => 'PriceSet',
163 'bao' => 'CRM_Price_BAO_PriceSet',
167 'name' => 'domain_id',
168 'type' => CRM_Utils_Type
::T_INT
,
169 'title' => ts('Price Set Domain'),
170 'description' => ts('Which Domain is this price-set for'),
171 'where' => 'civicrm_price_set.domain_id',
172 'table_name' => 'civicrm_price_set',
173 'entity' => 'PriceSet',
174 'bao' => 'CRM_Price_BAO_PriceSet',
176 'FKClassName' => 'CRM_Core_DAO_Domain',
180 'pseudoconstant' => [
181 'table' => 'civicrm_domain',
183 'labelColumn' => 'name',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Name'),
190 'description' => ts('Variable name/programmatic handle for this set of price fields.'),
193 'size' => CRM_Utils_Type
::HUGE
,
194 'where' => 'civicrm_price_set.name',
195 'table_name' => 'civicrm_price_set',
196 'entity' => 'PriceSet',
197 'bao' => 'CRM_Price_BAO_PriceSet',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Price Set Title'),
207 'description' => ts('Displayed title for the Price Set.'),
210 'size' => CRM_Utils_Type
::HUGE
,
211 'where' => 'civicrm_price_set.title',
212 'table_name' => 'civicrm_price_set',
213 'entity' => 'PriceSet',
214 'bao' => 'CRM_Price_BAO_PriceSet',
221 'name' => 'is_active',
222 'type' => CRM_Utils_Type
::T_BOOLEAN
,
223 'title' => ts('Price Set Is Active?'),
224 'description' => ts('Is this price set active'),
225 'where' => 'civicrm_price_set.is_active',
227 'table_name' => 'civicrm_price_set',
228 'entity' => 'PriceSet',
229 'bao' => 'CRM_Price_BAO_PriceSet',
232 'type' => 'CheckBox',
236 'name' => 'help_pre',
237 'type' => CRM_Utils_Type
::T_TEXT
,
238 'title' => ts('Price Set Pre Help'),
239 'description' => ts('Description and/or help text to display before fields in form.'),
242 'where' => 'civicrm_price_set.help_pre',
243 'table_name' => 'civicrm_price_set',
244 'entity' => 'PriceSet',
245 'bao' => 'CRM_Price_BAO_PriceSet',
248 'type' => 'TextArea',
252 'name' => 'help_post',
253 'type' => CRM_Utils_Type
::T_TEXT
,
254 'title' => ts('Price Set Post Help'),
255 'description' => ts('Description and/or help text to display after fields in form.'),
258 'where' => 'civicrm_price_set.help_post',
259 'table_name' => 'civicrm_price_set',
260 'entity' => 'PriceSet',
261 'bao' => 'CRM_Price_BAO_PriceSet',
264 'type' => 'TextArea',
268 'name' => 'javascript',
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Price Set Javascript'),
271 'description' => ts('Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'),
273 'size' => CRM_Utils_Type
::BIG
,
274 'where' => 'civicrm_price_set.javascript',
275 'table_name' => 'civicrm_price_set',
276 'entity' => 'PriceSet',
277 'bao' => 'CRM_Price_BAO_PriceSet',
285 'type' => CRM_Utils_Type
::T_STRING
,
286 'title' => ts('Price Set Extends'),
287 'description' => ts('What components are using this price set?'),
290 'size' => CRM_Utils_Type
::HUGE
,
291 'where' => 'civicrm_price_set.extends',
292 'table_name' => 'civicrm_price_set',
293 'entity' => 'PriceSet',
294 'bao' => 'CRM_Price_BAO_PriceSet',
299 'pseudoconstant' => [
300 'table' => 'civicrm_component',
302 'labelColumn' => 'name',
305 'financial_type_id' => [
306 'name' => 'financial_type_id',
307 'type' => CRM_Utils_Type
::T_INT
,
308 'title' => ts('Financial Type'),
309 'description' => ts('FK to Financial Type(for membership price sets only).'),
310 'where' => 'civicrm_price_set.financial_type_id',
312 'table_name' => 'civicrm_price_set',
313 'entity' => 'PriceSet',
314 'bao' => 'CRM_Price_BAO_PriceSet',
316 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
320 'pseudoconstant' => [
321 'table' => 'civicrm_financial_type',
323 'labelColumn' => 'name',
326 'is_quick_config' => [
327 'name' => 'is_quick_config',
328 'type' => CRM_Utils_Type
::T_BOOLEAN
,
329 'title' => ts('Is Price Set Quick Config?'),
330 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'),
331 'where' => 'civicrm_price_set.is_quick_config',
333 'table_name' => 'civicrm_price_set',
334 'entity' => 'PriceSet',
335 'bao' => 'CRM_Price_BAO_PriceSet',
338 'type' => 'CheckBox',
342 'name' => 'is_reserved',
343 'type' => CRM_Utils_Type
::T_BOOLEAN
,
344 'title' => ts('Price Set Is Reserved'),
345 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'),
346 'where' => 'civicrm_price_set.is_reserved',
348 'table_name' => 'civicrm_price_set',
349 'entity' => 'PriceSet',
350 'bao' => 'CRM_Price_BAO_PriceSet',
353 'type' => 'CheckBox',
357 'name' => 'min_amount',
358 'type' => CRM_Utils_Type
::T_INT
,
359 'title' => ts('Minimum Amount'),
360 'description' => ts('Minimum Amount required for this set.'),
361 'where' => 'civicrm_price_set.min_amount',
363 'table_name' => 'civicrm_price_set',
364 'entity' => 'PriceSet',
365 'bao' => 'CRM_Price_BAO_PriceSet',
372 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
374 return Civi
::$statics[__CLASS__
]['fields'];
378 * Return a mapping from field-name to the corresponding key (as used in fields()).
381 * Array(string $name => string $uniqueName).
383 public static function &fieldKeys() {
384 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
385 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
387 return Civi
::$statics[__CLASS__
]['fieldKeys'];
391 * Returns the names of this table
395 public static function getTableName() {
396 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
400 * Returns if this table needs to be logged
404 public function getLog() {
409 * Returns the list of fields that can be imported
411 * @param bool $prefix
415 public static function &import($prefix = FALSE) {
416 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_set', $prefix, []);
421 * Returns the list of fields that can be exported
423 * @param bool $prefix
427 public static function &export($prefix = FALSE) {
428 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_set', $prefix, []);
433 * Returns the list of indices
435 * @param bool $localize
439 public static function indices($localize = TRUE) {
446 'localizable' => FALSE,
448 'sig' => 'civicrm_price_set::1::name',
451 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;