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