Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
0f03f337 | 5 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Price/PriceSet.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:7250a5af1e713fc047875f2cc22443ff) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Price Set | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Which Domain is this price-set for | |
40 | * | |
41 | * @var int unsigned | |
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 | * | |
62 | * @var boolean | |
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 | * | |
97 | * @var int unsigned | |
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 | * | |
104 | * @var boolean | |
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 | * | |
111 | * @var boolean | |
112 | */ | |
113 | public $is_reserved; | |
c3fc2621 | 114 | |
601c7a24 | 115 | /** |
116 | * Minimum Amount required for this set. | |
117 | * | |
118 | * @var int unsigned | |
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 | |
e501603b | 130 | /** |
f41f0342 | 131 | * Returns foreign keys and entity references. |
e501603b TO |
132 | * |
133 | * @return array | |
134 | * [CRM_Core_Reference_Interface] | |
135 | */ | |
c3fc2621 | 136 | public static function getReferenceColumns() { |
346aaaba TO |
137 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
138 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
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'); | |
346aaaba | 141 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 142 | } |
346aaaba | 143 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 144 | } |
c3fc2621 | 145 | |
e501603b TO |
146 | /** |
147 | * Returns all the column names of this table | |
148 | * | |
149 | * @return array | |
150 | */ | |
c3fc2621 | 151 | public static function &fields() { |
346aaaba | 152 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
153 | Civi::$statics[__CLASS__]['fields'] = [ |
154 | 'id' => [ | |
e501603b TO |
155 | 'name' => 'id', |
156 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 157 | 'title' => ts('Price Set ID'), |
e501603b | 158 | 'description' => 'Price Set', |
c3fc2621 | 159 | 'required' => TRUE, |
522a26c9 | 160 | 'table_name' => 'civicrm_price_set', |
161 | 'entity' => 'PriceSet', | |
162 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 163 | 'localizable' => 0, |
c3fc2621 CW |
164 | ], |
165 | 'domain_id' => [ | |
e501603b TO |
166 | 'name' => 'domain_id', |
167 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 168 | 'title' => ts('Price Set Domain'), |
e501603b | 169 | 'description' => 'Which Domain is this price-set for', |
522a26c9 | 170 | 'table_name' => 'civicrm_price_set', |
171 | 'entity' => 'PriceSet', | |
172 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 173 | 'localizable' => 0, |
e501603b | 174 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 175 | 'html' => [ |
e501603b | 176 | 'type' => 'Text', |
c3fc2621 CW |
177 | ], |
178 | 'pseudoconstant' => [ | |
e501603b TO |
179 | 'table' => 'civicrm_domain', |
180 | 'keyColumn' => 'id', | |
181 | 'labelColumn' => 'name', | |
c3fc2621 CW |
182 | ] |
183 | ], | |
184 | 'name' => [ | |
e501603b TO |
185 | 'name' => 'name', |
186 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 187 | 'title' => ts('Name'), |
e501603b | 188 | 'description' => 'Variable name/programmatic handle for this set of price fields.', |
c3fc2621 | 189 | 'required' => TRUE, |
e501603b TO |
190 | 'maxlength' => 255, |
191 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 192 | 'table_name' => 'civicrm_price_set', |
193 | 'entity' => 'PriceSet', | |
194 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 195 | 'localizable' => 0, |
c3fc2621 | 196 | 'html' => [ |
e501603b | 197 | 'type' => 'Text', |
c3fc2621 CW |
198 | ], |
199 | ], | |
200 | 'title' => [ | |
e501603b TO |
201 | 'name' => 'title', |
202 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 203 | 'title' => ts('Price Set Title'), |
e501603b | 204 | 'description' => 'Displayed title for the Price Set.', |
c3fc2621 | 205 | 'required' => TRUE, |
e501603b TO |
206 | 'maxlength' => 255, |
207 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 208 | 'table_name' => 'civicrm_price_set', |
209 | 'entity' => 'PriceSet', | |
210 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 211 | 'localizable' => 1, |
c3fc2621 | 212 | 'html' => [ |
e501603b | 213 | 'type' => 'Text', |
c3fc2621 CW |
214 | ], |
215 | ], | |
216 | 'is_active' => [ | |
e501603b TO |
217 | 'name' => 'is_active', |
218 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 219 | 'title' => ts('Price Set Is Active?'), |
e501603b TO |
220 | 'description' => 'Is this price set active', |
221 | 'default' => '1', | |
522a26c9 | 222 | 'table_name' => 'civicrm_price_set', |
223 | 'entity' => 'PriceSet', | |
224 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 225 | 'localizable' => 0, |
c3fc2621 | 226 | 'html' => [ |
e501603b | 227 | 'type' => 'CheckBox', |
c3fc2621 CW |
228 | ], |
229 | ], | |
230 | 'help_pre' => [ | |
e501603b TO |
231 | 'name' => 'help_pre', |
232 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 233 | 'title' => ts('Price Set Pre Help'), |
e501603b TO |
234 | 'description' => 'Description and/or help text to display before fields in form.', |
235 | 'rows' => 4, | |
236 | 'cols' => 80, | |
522a26c9 | 237 | 'table_name' => 'civicrm_price_set', |
238 | 'entity' => 'PriceSet', | |
239 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 240 | 'localizable' => 1, |
c3fc2621 | 241 | 'html' => [ |
e501603b | 242 | 'type' => 'TextArea', |
c3fc2621 CW |
243 | ], |
244 | ], | |
245 | 'help_post' => [ | |
e501603b TO |
246 | 'name' => 'help_post', |
247 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 248 | 'title' => ts('Price Set Post Help'), |
e501603b TO |
249 | 'description' => 'Description and/or help text to display after fields in form.', |
250 | 'rows' => 4, | |
251 | 'cols' => 80, | |
522a26c9 | 252 | 'table_name' => 'civicrm_price_set', |
253 | 'entity' => 'PriceSet', | |
254 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 255 | 'localizable' => 1, |
c3fc2621 | 256 | 'html' => [ |
e501603b | 257 | 'type' => 'TextArea', |
c3fc2621 CW |
258 | ], |
259 | ], | |
260 | 'javascript' => [ | |
e501603b TO |
261 | 'name' => 'javascript', |
262 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 263 | 'title' => ts('Price Set Javascript'), |
e501603b TO |
264 | 'description' => 'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional', |
265 | 'maxlength' => 64, | |
266 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 267 | 'table_name' => 'civicrm_price_set', |
268 | 'entity' => 'PriceSet', | |
269 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 270 | 'localizable' => 0, |
c3fc2621 | 271 | 'html' => [ |
e501603b | 272 | 'type' => 'Text', |
c3fc2621 CW |
273 | ], |
274 | ], | |
275 | 'extends' => [ | |
e501603b TO |
276 | 'name' => 'extends', |
277 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 278 | 'title' => ts('Price Set Extends'), |
e501603b | 279 | 'description' => 'What components are using this price set?', |
c3fc2621 | 280 | 'required' => TRUE, |
e501603b TO |
281 | 'maxlength' => 255, |
282 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 283 | 'table_name' => 'civicrm_price_set', |
284 | 'entity' => 'PriceSet', | |
285 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 286 | 'localizable' => 0, |
c3fc2621 | 287 | 'html' => [ |
e501603b | 288 | 'type' => 'Text', |
c3fc2621 CW |
289 | ], |
290 | 'pseudoconstant' => [ | |
e501603b TO |
291 | 'table' => 'civicrm_component', |
292 | 'keyColumn' => 'id', | |
293 | 'labelColumn' => 'name', | |
c3fc2621 CW |
294 | ] |
295 | ], | |
296 | 'financial_type_id' => [ | |
e501603b TO |
297 | 'name' => 'financial_type_id', |
298 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 299 | 'title' => ts('Financial Type'), |
e501603b TO |
300 | 'description' => 'FK to Financial Type(for membership price sets only).', |
301 | 'default' => 'NULL', | |
522a26c9 | 302 | 'table_name' => 'civicrm_price_set', |
303 | 'entity' => 'PriceSet', | |
304 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 305 | 'localizable' => 0, |
e501603b | 306 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 307 | 'html' => [ |
e501603b | 308 | 'type' => 'Select', |
c3fc2621 CW |
309 | ], |
310 | 'pseudoconstant' => [ | |
e501603b TO |
311 | 'table' => 'civicrm_financial_type', |
312 | 'keyColumn' => 'id', | |
313 | 'labelColumn' => 'name', | |
c3fc2621 CW |
314 | ] |
315 | ], | |
316 | 'is_quick_config' => [ | |
e501603b TO |
317 | 'name' => 'is_quick_config', |
318 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 319 | 'title' => ts('Is Price Set Quick Config?'), |
e501603b | 320 | 'description' => 'Is set if edited on Contribution or Event Page rather than through Manage Price Sets', |
522a26c9 | 321 | 'table_name' => 'civicrm_price_set', |
322 | 'entity' => 'PriceSet', | |
323 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 324 | 'localizable' => 0, |
c3fc2621 | 325 | 'html' => [ |
e501603b | 326 | 'type' => 'CheckBox', |
c3fc2621 CW |
327 | ], |
328 | ], | |
329 | 'is_reserved' => [ | |
e501603b TO |
330 | 'name' => 'is_reserved', |
331 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 332 | 'title' => ts('Price Set Is Reserved'), |
e501603b | 333 | 'description' => 'Is this a predefined system price set (i.e. it can not be deleted, edited)?', |
522a26c9 | 334 | 'table_name' => 'civicrm_price_set', |
335 | 'entity' => 'PriceSet', | |
336 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 337 | 'localizable' => 0, |
c3fc2621 | 338 | 'html' => [ |
e501603b | 339 | 'type' => 'CheckBox', |
c3fc2621 CW |
340 | ], |
341 | ], | |
342 | 'min_amount' => [ | |
601c7a24 | 343 | 'name' => 'min_amount', |
344 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 345 | 'title' => ts('Minimum Amount'), |
601c7a24 | 346 | 'description' => 'Minimum Amount required for this set.', |
522a26c9 | 347 | 'table_name' => 'civicrm_price_set', |
348 | 'entity' => 'PriceSet', | |
349 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 350 | 'localizable' => 0, |
c3fc2621 | 351 | 'html' => [ |
601c7a24 | 352 | 'type' => 'Text', |
c3fc2621 CW |
353 | ], |
354 | ], | |
355 | ]; | |
346aaaba | 356 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 357 | } |
346aaaba | 358 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 359 | } |
c3fc2621 | 360 | |
e501603b | 361 | /** |
bd8e0b14 | 362 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
363 | * |
364 | * @return array | |
bd8e0b14 | 365 | * Array(string $name => string $uniqueName). |
e501603b | 366 | */ |
c3fc2621 | 367 | public static function &fieldKeys() { |
bd8e0b14 TO |
368 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
369 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 370 | } |
bd8e0b14 | 371 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 372 | } |
c3fc2621 | 373 | |
e501603b TO |
374 | /** |
375 | * Returns the names of this table | |
376 | * | |
377 | * @return string | |
378 | */ | |
c3fc2621 | 379 | public static function getTableName() { |
e501603b TO |
380 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
381 | } | |
c3fc2621 | 382 | |
e501603b TO |
383 | /** |
384 | * Returns if this table needs to be logged | |
385 | * | |
c3fc2621 | 386 | * @return bool |
e501603b | 387 | */ |
c3fc2621 | 388 | public function getLog() { |
e501603b TO |
389 | return self::$_log; |
390 | } | |
c3fc2621 | 391 | |
e501603b TO |
392 | /** |
393 | * Returns the list of fields that can be imported | |
394 | * | |
395 | * @param bool $prefix | |
396 | * | |
397 | * @return array | |
398 | */ | |
c3fc2621 CW |
399 | public static function &import($prefix = FALSE) { |
400 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, []); | |
60808919 | 401 | return $r; |
e501603b | 402 | } |
c3fc2621 | 403 | |
e501603b TO |
404 | /** |
405 | * Returns the list of fields that can be exported | |
406 | * | |
407 | * @param bool $prefix | |
408 | * | |
409 | * @return array | |
410 | */ | |
c3fc2621 CW |
411 | public static function &export($prefix = FALSE) { |
412 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, []); | |
60808919 | 413 | return $r; |
e501603b | 414 | } |
c3fc2621 | 415 | |
e7a6b91a AS |
416 | /** |
417 | * Returns the list of indices | |
c3fc2621 CW |
418 | * |
419 | * @param bool $localize | |
420 | * | |
421 | * @return array | |
e7a6b91a AS |
422 | */ |
423 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
424 | $indices = [ |
425 | 'UI_name' => [ | |
e7a6b91a | 426 | 'name' => 'UI_name', |
c3fc2621 | 427 | 'field' => [ |
e7a6b91a | 428 | 0 => 'name', |
c3fc2621 CW |
429 | ], |
430 | 'localizable' => FALSE, | |
431 | 'unique' => TRUE, | |
e7a6b91a | 432 | 'sig' => 'civicrm_price_set::1::name', |
c3fc2621 CW |
433 | ], |
434 | ]; | |
e7a6b91a AS |
435 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
436 | } | |
c3fc2621 | 437 | |
e501603b | 438 | } |