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