Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Price/PriceSet.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
a9d0587b | 9 | * (GenCodeChecksum:53c1906856d1a16d2edba1caa6a4fafc) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the PriceSet entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_price_set'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Price Set | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Which Domain is this price-set for | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $domain_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Variable name/programmatic handle for this set of price fields. | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $name; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Displayed title for the Price Set. | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $title; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Is this price set active | |
61 | * | |
e6ca0a57 | 62 | * @var bool |
e501603b TO |
63 | */ |
64 | public $is_active; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Description and/or help text to display before fields in form. | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $help_pre; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Description and/or help text to display after fields in form. | |
75 | * | |
76 | * @var text | |
77 | */ | |
78 | public $help_post; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional | |
82 | * | |
83 | * @var string | |
84 | */ | |
85 | public $javascript; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * What components are using this price set? | |
89 | * | |
90 | * @var string | |
91 | */ | |
92 | public $extends; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * FK to Financial Type(for membership price sets only). | |
96 | * | |
e6ca0a57 | 97 | * @var int |
e501603b TO |
98 | */ |
99 | public $financial_type_id; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Is set if edited on Contribution or Event Page rather than through Manage Price Sets | |
103 | * | |
e6ca0a57 | 104 | * @var bool |
e501603b TO |
105 | */ |
106 | public $is_quick_config; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * Is this a predefined system price set (i.e. it can not be deleted, edited)? | |
110 | * | |
e6ca0a57 | 111 | * @var bool |
e501603b TO |
112 | */ |
113 | public $is_reserved; | |
c3fc2621 | 114 | |
601c7a24 | 115 | /** |
116 | * Minimum Amount required for this set. | |
117 | * | |
e6ca0a57 | 118 | * @var int |
601c7a24 | 119 | */ |
120 | public $min_amount; | |
c3fc2621 | 121 | |
e501603b | 122 | /** |
f41f0342 | 123 | * Class constructor. |
e501603b | 124 | */ |
c3fc2621 | 125 | public function __construct() { |
e501603b TO |
126 | $this->__table = 'civicrm_price_set'; |
127 | parent::__construct(); | |
128 | } | |
c3fc2621 | 129 | |
449c4e6b CW |
130 | /** |
131 | * Returns localized title of this entity. | |
132 | */ | |
133 | public static function getEntityTitle() { | |
134 | return ts('Price Sets'); | |
135 | } | |
136 | ||
e501603b | 137 | /** |
f41f0342 | 138 | * Returns foreign keys and entity references. |
e501603b TO |
139 | * |
140 | * @return array | |
141 | * [CRM_Core_Reference_Interface] | |
142 | */ | |
c3fc2621 | 143 | public static function getReferenceColumns() { |
346aaaba | 144 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 145 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
146 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
147 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 148 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 149 | } |
346aaaba | 150 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 151 | } |
c3fc2621 | 152 | |
e501603b TO |
153 | /** |
154 | * Returns all the column names of this table | |
155 | * | |
156 | * @return array | |
157 | */ | |
c3fc2621 | 158 | public static function &fields() { |
346aaaba | 159 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
160 | Civi::$statics[__CLASS__]['fields'] = [ |
161 | 'id' => [ | |
e501603b TO |
162 | 'name' => 'id', |
163 | 'type' => CRM_Utils_Type::T_INT, | |
a0a2c91d | 164 | 'title' => ts('Price Set'), |
215b423e | 165 | 'description' => ts('Price Set'), |
c3fc2621 | 166 | 'required' => TRUE, |
a36434b9 | 167 | 'where' => 'civicrm_price_set.id', |
522a26c9 | 168 | 'table_name' => 'civicrm_price_set', |
169 | 'entity' => 'PriceSet', | |
170 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 171 | 'localizable' => 0, |
a0a2c91d MWMC |
172 | 'html' => [ |
173 | 'type' => 'Select', | |
174 | ], | |
a9d0587b | 175 | 'add' => '1.8', |
c3fc2621 CW |
176 | ], |
177 | 'domain_id' => [ | |
e501603b TO |
178 | 'name' => 'domain_id', |
179 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 180 | 'title' => ts('Price Set Domain'), |
215b423e | 181 | 'description' => ts('Which Domain is this price-set for'), |
a36434b9 | 182 | 'where' => 'civicrm_price_set.domain_id', |
522a26c9 | 183 | 'table_name' => 'civicrm_price_set', |
184 | 'entity' => 'PriceSet', | |
185 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 186 | 'localizable' => 0, |
e501603b | 187 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 188 | 'html' => [ |
e501603b | 189 | 'type' => 'Text', |
c3fc2621 CW |
190 | ], |
191 | 'pseudoconstant' => [ | |
e501603b TO |
192 | 'table' => 'civicrm_domain', |
193 | 'keyColumn' => 'id', | |
194 | 'labelColumn' => 'name', | |
e6ca0a57 | 195 | ], |
a9d0587b | 196 | 'add' => '3.1', |
c3fc2621 CW |
197 | ], |
198 | 'name' => [ | |
e501603b TO |
199 | 'name' => 'name', |
200 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 201 | 'title' => ts('Name'), |
215b423e | 202 | 'description' => ts('Variable name/programmatic handle for this set of price fields.'), |
c3fc2621 | 203 | 'required' => TRUE, |
e501603b TO |
204 | 'maxlength' => 255, |
205 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 206 | 'where' => 'civicrm_price_set.name', |
522a26c9 | 207 | 'table_name' => 'civicrm_price_set', |
208 | 'entity' => 'PriceSet', | |
209 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 210 | 'localizable' => 0, |
c3fc2621 | 211 | 'html' => [ |
e501603b | 212 | 'type' => 'Text', |
c3fc2621 | 213 | ], |
a9d0587b | 214 | 'add' => '1.8', |
c3fc2621 CW |
215 | ], |
216 | 'title' => [ | |
e501603b TO |
217 | 'name' => 'title', |
218 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 219 | 'title' => ts('Price Set Title'), |
215b423e | 220 | 'description' => ts('Displayed title for the Price Set.'), |
c3fc2621 | 221 | 'required' => TRUE, |
e501603b TO |
222 | 'maxlength' => 255, |
223 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 224 | 'where' => 'civicrm_price_set.title', |
522a26c9 | 225 | 'table_name' => 'civicrm_price_set', |
226 | 'entity' => 'PriceSet', | |
227 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 228 | 'localizable' => 1, |
c3fc2621 | 229 | 'html' => [ |
e501603b | 230 | 'type' => 'Text', |
c3fc2621 | 231 | ], |
a9d0587b | 232 | 'add' => '1.8', |
c3fc2621 CW |
233 | ], |
234 | 'is_active' => [ | |
e501603b TO |
235 | 'name' => 'is_active', |
236 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 237 | 'title' => ts('Price Set Is Active?'), |
215b423e | 238 | 'description' => ts('Is this price set active'), |
a36434b9 | 239 | 'where' => 'civicrm_price_set.is_active', |
e501603b | 240 | 'default' => '1', |
522a26c9 | 241 | 'table_name' => 'civicrm_price_set', |
242 | 'entity' => 'PriceSet', | |
243 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 244 | 'localizable' => 0, |
c3fc2621 | 245 | 'html' => [ |
e501603b | 246 | 'type' => 'CheckBox', |
c3fc2621 | 247 | ], |
a9d0587b | 248 | 'add' => '1.8', |
c3fc2621 CW |
249 | ], |
250 | 'help_pre' => [ | |
e501603b TO |
251 | 'name' => 'help_pre', |
252 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 253 | 'title' => ts('Price Set Pre Help'), |
215b423e | 254 | 'description' => ts('Description and/or help text to display before fields in form.'), |
e501603b TO |
255 | 'rows' => 4, |
256 | 'cols' => 80, | |
a36434b9 | 257 | 'where' => 'civicrm_price_set.help_pre', |
522a26c9 | 258 | 'table_name' => 'civicrm_price_set', |
259 | 'entity' => 'PriceSet', | |
260 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 261 | 'localizable' => 1, |
c3fc2621 | 262 | 'html' => [ |
e501603b | 263 | 'type' => 'TextArea', |
c3fc2621 | 264 | ], |
a9d0587b | 265 | 'add' => '1.8', |
c3fc2621 CW |
266 | ], |
267 | 'help_post' => [ | |
e501603b TO |
268 | 'name' => 'help_post', |
269 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 270 | 'title' => ts('Price Set Post Help'), |
215b423e | 271 | 'description' => ts('Description and/or help text to display after fields in form.'), |
e501603b TO |
272 | 'rows' => 4, |
273 | 'cols' => 80, | |
a36434b9 | 274 | 'where' => 'civicrm_price_set.help_post', |
522a26c9 | 275 | 'table_name' => 'civicrm_price_set', |
276 | 'entity' => 'PriceSet', | |
277 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 278 | 'localizable' => 1, |
c3fc2621 | 279 | 'html' => [ |
e501603b | 280 | 'type' => 'TextArea', |
c3fc2621 | 281 | ], |
a9d0587b | 282 | 'add' => '1.8', |
c3fc2621 CW |
283 | ], |
284 | 'javascript' => [ | |
e501603b TO |
285 | 'name' => 'javascript', |
286 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 287 | 'title' => ts('Price Set Javascript'), |
215b423e | 288 | 'description' => ts('Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional'), |
e501603b TO |
289 | 'maxlength' => 64, |
290 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 291 | 'where' => 'civicrm_price_set.javascript', |
522a26c9 | 292 | 'table_name' => 'civicrm_price_set', |
293 | 'entity' => 'PriceSet', | |
294 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 295 | 'localizable' => 0, |
c3fc2621 | 296 | 'html' => [ |
e501603b | 297 | 'type' => 'Text', |
c3fc2621 | 298 | ], |
a9d0587b | 299 | 'add' => '1.8', |
c3fc2621 CW |
300 | ], |
301 | 'extends' => [ | |
e501603b TO |
302 | 'name' => 'extends', |
303 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 304 | 'title' => ts('Price Set Extends'), |
215b423e | 305 | 'description' => ts('What components are using this price set?'), |
c3fc2621 | 306 | 'required' => TRUE, |
e501603b TO |
307 | 'maxlength' => 255, |
308 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 309 | 'where' => 'civicrm_price_set.extends', |
522a26c9 | 310 | 'table_name' => 'civicrm_price_set', |
311 | 'entity' => 'PriceSet', | |
312 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 313 | 'localizable' => 0, |
c3fc2621 | 314 | 'html' => [ |
e501603b | 315 | 'type' => 'Text', |
c3fc2621 CW |
316 | ], |
317 | 'pseudoconstant' => [ | |
e501603b TO |
318 | 'table' => 'civicrm_component', |
319 | 'keyColumn' => 'id', | |
320 | 'labelColumn' => 'name', | |
e6ca0a57 | 321 | ], |
a9d0587b | 322 | 'add' => '3.1', |
c3fc2621 CW |
323 | ], |
324 | 'financial_type_id' => [ | |
e501603b TO |
325 | 'name' => 'financial_type_id', |
326 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 327 | 'title' => ts('Financial Type'), |
215b423e | 328 | 'description' => ts('FK to Financial Type(for membership price sets only).'), |
a36434b9 | 329 | 'where' => 'civicrm_price_set.financial_type_id', |
e501603b | 330 | 'default' => 'NULL', |
522a26c9 | 331 | 'table_name' => 'civicrm_price_set', |
332 | 'entity' => 'PriceSet', | |
333 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 334 | 'localizable' => 0, |
e501603b | 335 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 336 | 'html' => [ |
e501603b | 337 | 'type' => 'Select', |
c3fc2621 CW |
338 | ], |
339 | 'pseudoconstant' => [ | |
e501603b TO |
340 | 'table' => 'civicrm_financial_type', |
341 | 'keyColumn' => 'id', | |
342 | 'labelColumn' => 'name', | |
e6ca0a57 | 343 | ], |
a9d0587b | 344 | 'add' => '4.3', |
c3fc2621 CW |
345 | ], |
346 | 'is_quick_config' => [ | |
e501603b TO |
347 | 'name' => 'is_quick_config', |
348 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 349 | 'title' => ts('Is Price Set Quick Config?'), |
215b423e | 350 | 'description' => ts('Is set if edited on Contribution or Event Page rather than through Manage Price Sets'), |
a36434b9 | 351 | 'where' => 'civicrm_price_set.is_quick_config', |
45a83e42 | 352 | 'default' => '0', |
522a26c9 | 353 | 'table_name' => 'civicrm_price_set', |
354 | 'entity' => 'PriceSet', | |
355 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 356 | 'localizable' => 0, |
c3fc2621 | 357 | 'html' => [ |
e501603b | 358 | 'type' => 'CheckBox', |
c3fc2621 | 359 | ], |
a9d0587b | 360 | 'add' => '4.1', |
c3fc2621 CW |
361 | ], |
362 | 'is_reserved' => [ | |
e501603b TO |
363 | 'name' => 'is_reserved', |
364 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 365 | 'title' => ts('Price Set Is Reserved'), |
215b423e | 366 | 'description' => ts('Is this a predefined system price set (i.e. it can not be deleted, edited)?'), |
a36434b9 | 367 | 'where' => 'civicrm_price_set.is_reserved', |
45a83e42 | 368 | 'default' => '0', |
522a26c9 | 369 | 'table_name' => 'civicrm_price_set', |
370 | 'entity' => 'PriceSet', | |
371 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 372 | 'localizable' => 0, |
c3fc2621 | 373 | 'html' => [ |
e501603b | 374 | 'type' => 'CheckBox', |
c3fc2621 | 375 | ], |
a9d0587b | 376 | 'add' => '4.2', |
c3fc2621 CW |
377 | ], |
378 | 'min_amount' => [ | |
601c7a24 | 379 | 'name' => 'min_amount', |
380 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 381 | 'title' => ts('Minimum Amount'), |
215b423e | 382 | 'description' => ts('Minimum Amount required for this set.'), |
a36434b9 | 383 | 'where' => 'civicrm_price_set.min_amount', |
45a83e42 | 384 | 'default' => '0', |
522a26c9 | 385 | 'table_name' => 'civicrm_price_set', |
386 | 'entity' => 'PriceSet', | |
387 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 388 | 'localizable' => 0, |
c3fc2621 | 389 | 'html' => [ |
601c7a24 | 390 | 'type' => 'Text', |
c3fc2621 | 391 | ], |
a9d0587b | 392 | 'add' => '4.7', |
c3fc2621 CW |
393 | ], |
394 | ]; | |
346aaaba | 395 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 396 | } |
346aaaba | 397 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 398 | } |
c3fc2621 | 399 | |
e501603b | 400 | /** |
bd8e0b14 | 401 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
402 | * |
403 | * @return array | |
bd8e0b14 | 404 | * Array(string $name => string $uniqueName). |
e501603b | 405 | */ |
c3fc2621 | 406 | public static function &fieldKeys() { |
bd8e0b14 TO |
407 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
408 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 409 | } |
bd8e0b14 | 410 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 411 | } |
c3fc2621 | 412 | |
e501603b TO |
413 | /** |
414 | * Returns the names of this table | |
415 | * | |
416 | * @return string | |
417 | */ | |
c3fc2621 | 418 | public static function getTableName() { |
e501603b TO |
419 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
420 | } | |
c3fc2621 | 421 | |
e501603b TO |
422 | /** |
423 | * Returns if this table needs to be logged | |
424 | * | |
c3fc2621 | 425 | * @return bool |
e501603b | 426 | */ |
c3fc2621 | 427 | public function getLog() { |
e501603b TO |
428 | return self::$_log; |
429 | } | |
c3fc2621 | 430 | |
e501603b TO |
431 | /** |
432 | * Returns the list of fields that can be imported | |
433 | * | |
434 | * @param bool $prefix | |
435 | * | |
436 | * @return array | |
437 | */ | |
c3fc2621 CW |
438 | public static function &import($prefix = FALSE) { |
439 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, []); | |
60808919 | 440 | return $r; |
e501603b | 441 | } |
c3fc2621 | 442 | |
e501603b TO |
443 | /** |
444 | * Returns the list of fields that can be exported | |
445 | * | |
446 | * @param bool $prefix | |
447 | * | |
448 | * @return array | |
449 | */ | |
c3fc2621 CW |
450 | public static function &export($prefix = FALSE) { |
451 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, []); | |
60808919 | 452 | return $r; |
e501603b | 453 | } |
c3fc2621 | 454 | |
e7a6b91a AS |
455 | /** |
456 | * Returns the list of indices | |
c3fc2621 CW |
457 | * |
458 | * @param bool $localize | |
459 | * | |
460 | * @return array | |
e7a6b91a AS |
461 | */ |
462 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
463 | $indices = [ |
464 | 'UI_name' => [ | |
e7a6b91a | 465 | 'name' => 'UI_name', |
c3fc2621 | 466 | 'field' => [ |
e7a6b91a | 467 | 0 => 'name', |
c3fc2621 CW |
468 | ], |
469 | 'localizable' => FALSE, | |
470 | 'unique' => TRUE, | |
e7a6b91a | 471 | 'sig' => 'civicrm_price_set::1::name', |
c3fc2621 CW |
472 | ], |
473 | ]; | |
e7a6b91a AS |
474 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
475 | } | |
c3fc2621 | 476 | |
e501603b | 477 | } |