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