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