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