Add titles and icons to entities
[civicrm-core.git] / CRM / Member / DAO / MembershipType.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Member/MembershipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f5bc2479f6a11bf6e573782d008ca262)
10 */
11
12 /**
13 * Database access object for the MembershipType entity.
14 */
15 class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_membership_type';
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 * Membership Id
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Which Domain is this match entry for
40 *
41 * @var int
42 */
43 public $domain_id;
44
45 /**
46 * Name of Membership Type
47 *
48 * @var string
49 */
50 public $name;
51
52 /**
53 * Description of Membership Type
54 *
55 * @var string
56 */
57 public $description;
58
59 /**
60 * Owner organization for this membership type. FK to Contact ID
61 *
62 * @var int
63 */
64 public $member_of_contact_id;
65
66 /**
67 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
68 *
69 * @var int
70 */
71 public $financial_type_id;
72
73 /**
74 * Minimum fee for this membership (0 for free/complimentary memberships).
75 *
76 * @var float
77 */
78 public $minimum_fee;
79
80 /**
81 * Unit in which membership period is expressed.
82 *
83 * @var string
84 */
85 public $duration_unit;
86
87 /**
88 * Number of duration units in membership period (e.g. 1 year, 12 months).
89 *
90 * @var int
91 */
92 public $duration_interval;
93
94 /**
95 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
96 *
97 * @var string
98 */
99 public $period_type;
100
101 /**
102 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
103 *
104 * @var int
105 */
106 public $fixed_period_start_day;
107
108 /**
109 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
110 *
111 * @var int
112 */
113 public $fixed_period_rollover_day;
114
115 /**
116 * FK to Relationship Type ID
117 *
118 * @var string
119 */
120 public $relationship_type_id;
121
122 /**
123 * @var string
124 */
125 public $relationship_direction;
126
127 /**
128 * Maximum number of related memberships.
129 *
130 * @var int
131 */
132 public $max_related;
133
134 /**
135 * @var string
136 */
137 public $visibility;
138
139 /**
140 * @var int
141 */
142 public $weight;
143
144 /**
145 * Receipt Text for membership signup
146 *
147 * @var string
148 */
149 public $receipt_text_signup;
150
151 /**
152 * Receipt Text for membership renewal
153 *
154 * @var string
155 */
156 public $receipt_text_renewal;
157
158 /**
159 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
160 *
161 * @var bool
162 */
163 public $auto_renew;
164
165 /**
166 * Is this membership_type enabled
167 *
168 * @var bool
169 */
170 public $is_active;
171
172 /**
173 * Class constructor.
174 */
175 public function __construct() {
176 $this->__table = 'civicrm_membership_type';
177 parent::__construct();
178 }
179
180 /**
181 * Returns localized title of this entity.
182 */
183 public static function getEntityTitle() {
184 return ts('Membership Types');
185 }
186
187 /**
188 * Returns foreign keys and entity references.
189 *
190 * @return array
191 * [CRM_Core_Reference_Interface]
192 */
193 public static function getReferenceColumns() {
194 if (!isset(Civi::$statics[__CLASS__]['links'])) {
195 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
196 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
197 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'member_of_contact_id', 'civicrm_contact', 'id');
198 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
199 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
200 }
201 return Civi::$statics[__CLASS__]['links'];
202 }
203
204 /**
205 * Returns all the column names of this table
206 *
207 * @return array
208 */
209 public static function &fields() {
210 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
211 Civi::$statics[__CLASS__]['fields'] = [
212 'id' => [
213 'name' => 'id',
214 'type' => CRM_Utils_Type::T_INT,
215 'title' => ts('Membership Type ID'),
216 'description' => ts('Membership Id'),
217 'required' => TRUE,
218 'where' => 'civicrm_membership_type.id',
219 'table_name' => 'civicrm_membership_type',
220 'entity' => 'MembershipType',
221 'bao' => 'CRM_Member_BAO_MembershipType',
222 'localizable' => 0,
223 ],
224 'domain_id' => [
225 'name' => 'domain_id',
226 'type' => CRM_Utils_Type::T_INT,
227 'title' => ts('Membership Type Domain'),
228 'description' => ts('Which Domain is this match entry for'),
229 'required' => TRUE,
230 'where' => 'civicrm_membership_type.domain_id',
231 'table_name' => 'civicrm_membership_type',
232 'entity' => 'MembershipType',
233 'bao' => 'CRM_Member_BAO_MembershipType',
234 'localizable' => 0,
235 'FKClassName' => 'CRM_Core_DAO_Domain',
236 'pseudoconstant' => [
237 'table' => 'civicrm_domain',
238 'keyColumn' => 'id',
239 'labelColumn' => 'name',
240 ],
241 ],
242 'membership_type' => [
243 'name' => 'name',
244 'type' => CRM_Utils_Type::T_STRING,
245 'title' => ts('Membership Type'),
246 'description' => ts('Name of Membership Type'),
247 'required' => TRUE,
248 'maxlength' => 128,
249 'size' => CRM_Utils_Type::HUGE,
250 'import' => TRUE,
251 'where' => 'civicrm_membership_type.name',
252 'export' => TRUE,
253 'table_name' => 'civicrm_membership_type',
254 'entity' => 'MembershipType',
255 'bao' => 'CRM_Member_BAO_MembershipType',
256 'localizable' => 1,
257 'html' => [
258 'type' => 'Text',
259 'label' => ts("Name"),
260 ],
261 ],
262 'description' => [
263 'name' => 'description',
264 'type' => CRM_Utils_Type::T_STRING,
265 'title' => ts('Membership Type Description'),
266 'description' => ts('Description of Membership Type'),
267 'maxlength' => 255,
268 'size' => CRM_Utils_Type::HUGE,
269 'where' => 'civicrm_membership_type.description',
270 'table_name' => 'civicrm_membership_type',
271 'entity' => 'MembershipType',
272 'bao' => 'CRM_Member_BAO_MembershipType',
273 'localizable' => 1,
274 'html' => [
275 'type' => 'TextArea',
276 'label' => ts("Description"),
277 ],
278 ],
279 'member_of_contact_id' => [
280 'name' => 'member_of_contact_id',
281 'type' => CRM_Utils_Type::T_INT,
282 'title' => ts('Membership Type Organization'),
283 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
284 'required' => TRUE,
285 'where' => 'civicrm_membership_type.member_of_contact_id',
286 'table_name' => 'civicrm_membership_type',
287 'entity' => 'MembershipType',
288 'bao' => 'CRM_Member_BAO_MembershipType',
289 'localizable' => 0,
290 'FKClassName' => 'CRM_Contact_DAO_Contact',
291 ],
292 'financial_type_id' => [
293 'name' => 'financial_type_id',
294 'type' => CRM_Utils_Type::T_INT,
295 'title' => ts('Membership Financial Type'),
296 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
297 'required' => TRUE,
298 'where' => 'civicrm_membership_type.financial_type_id',
299 'table_name' => 'civicrm_membership_type',
300 'entity' => 'MembershipType',
301 'bao' => 'CRM_Member_BAO_MembershipType',
302 'localizable' => 0,
303 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
304 'pseudoconstant' => [
305 'table' => 'civicrm_financial_type',
306 'keyColumn' => 'id',
307 'labelColumn' => 'name',
308 ],
309 ],
310 'minimum_fee' => [
311 'name' => 'minimum_fee',
312 'type' => CRM_Utils_Type::T_MONEY,
313 'title' => ts('Membership Type Minimum Fee'),
314 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
315 'precision' => [
316 18,
317 9,
318 ],
319 'where' => 'civicrm_membership_type.minimum_fee',
320 'default' => '0',
321 'table_name' => 'civicrm_membership_type',
322 'entity' => 'MembershipType',
323 'bao' => 'CRM_Member_BAO_MembershipType',
324 'localizable' => 0,
325 'html' => [
326 'type' => 'Text',
327 'label' => ts("Minimum Fee"),
328 ],
329 ],
330 'duration_unit' => [
331 'name' => 'duration_unit',
332 'type' => CRM_Utils_Type::T_STRING,
333 'title' => ts('Membership Type Duration Unit'),
334 'description' => ts('Unit in which membership period is expressed.'),
335 'maxlength' => 8,
336 'size' => CRM_Utils_Type::EIGHT,
337 'where' => 'civicrm_membership_type.duration_unit',
338 'table_name' => 'civicrm_membership_type',
339 'entity' => 'MembershipType',
340 'bao' => 'CRM_Member_BAO_MembershipType',
341 'localizable' => 0,
342 'html' => [
343 'type' => 'Select',
344 ],
345 'pseudoconstant' => [
346 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
347 ],
348 ],
349 'duration_interval' => [
350 'name' => 'duration_interval',
351 'type' => CRM_Utils_Type::T_INT,
352 'title' => ts('Membership Type Duration Interval'),
353 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
354 'where' => 'civicrm_membership_type.duration_interval',
355 'table_name' => 'civicrm_membership_type',
356 'entity' => 'MembershipType',
357 'bao' => 'CRM_Member_BAO_MembershipType',
358 'localizable' => 0,
359 'html' => [
360 'type' => 'Text',
361 ],
362 ],
363 'period_type' => [
364 'name' => 'period_type',
365 'type' => CRM_Utils_Type::T_STRING,
366 'title' => ts('Membership Type Plan'),
367 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
368 'maxlength' => 8,
369 'size' => CRM_Utils_Type::EIGHT,
370 'where' => 'civicrm_membership_type.period_type',
371 'table_name' => 'civicrm_membership_type',
372 'entity' => 'MembershipType',
373 'bao' => 'CRM_Member_BAO_MembershipType',
374 'localizable' => 0,
375 'html' => [
376 'type' => 'Select',
377 ],
378 'pseudoconstant' => [
379 'callback' => 'CRM_Core_SelectValues::periodType',
380 ],
381 ],
382 'fixed_period_start_day' => [
383 'name' => 'fixed_period_start_day',
384 'type' => CRM_Utils_Type::T_INT,
385 'title' => ts('Fixed Period Start Day'),
386 'description' => ts('For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.'),
387 'where' => 'civicrm_membership_type.fixed_period_start_day',
388 'table_name' => 'civicrm_membership_type',
389 'entity' => 'MembershipType',
390 'bao' => 'CRM_Member_BAO_MembershipType',
391 'localizable' => 0,
392 ],
393 'fixed_period_rollover_day' => [
394 'name' => 'fixed_period_rollover_day',
395 'type' => CRM_Utils_Type::T_INT,
396 'title' => ts('Fixed Period Rollover Day'),
397 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
398 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
399 'table_name' => 'civicrm_membership_type',
400 'entity' => 'MembershipType',
401 'bao' => 'CRM_Member_BAO_MembershipType',
402 'localizable' => 0,
403 ],
404 'relationship_type_id' => [
405 'name' => 'relationship_type_id',
406 'type' => CRM_Utils_Type::T_STRING,
407 'title' => ts('Membership Type Relationship'),
408 'description' => ts('FK to Relationship Type ID'),
409 'maxlength' => 64,
410 'size' => CRM_Utils_Type::BIG,
411 'where' => 'civicrm_membership_type.relationship_type_id',
412 'table_name' => 'civicrm_membership_type',
413 'entity' => 'MembershipType',
414 'bao' => 'CRM_Member_BAO_MembershipType',
415 'localizable' => 0,
416 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
417 ],
418 'relationship_direction' => [
419 'name' => 'relationship_direction',
420 'type' => CRM_Utils_Type::T_STRING,
421 'title' => ts('Relationship Direction'),
422 'maxlength' => 128,
423 'size' => CRM_Utils_Type::HUGE,
424 'where' => 'civicrm_membership_type.relationship_direction',
425 'table_name' => 'civicrm_membership_type',
426 'entity' => 'MembershipType',
427 'bao' => 'CRM_Member_BAO_MembershipType',
428 'localizable' => 0,
429 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
430 ],
431 'max_related' => [
432 'name' => 'max_related',
433 'type' => CRM_Utils_Type::T_INT,
434 'title' => ts('Max Related Members for Type'),
435 'description' => ts('Maximum number of related memberships.'),
436 'where' => 'civicrm_membership_type.max_related',
437 'table_name' => 'civicrm_membership_type',
438 'entity' => 'MembershipType',
439 'bao' => 'CRM_Member_BAO_MembershipType',
440 'localizable' => 0,
441 'html' => [
442 'type' => 'Text',
443 'label' => ts("Max Related"),
444 ],
445 ],
446 'visibility' => [
447 'name' => 'visibility',
448 'type' => CRM_Utils_Type::T_STRING,
449 'title' => ts('Visible'),
450 'maxlength' => 64,
451 'size' => CRM_Utils_Type::BIG,
452 'where' => 'civicrm_membership_type.visibility',
453 'table_name' => 'civicrm_membership_type',
454 'entity' => 'MembershipType',
455 'bao' => 'CRM_Member_BAO_MembershipType',
456 'localizable' => 0,
457 'html' => [
458 'type' => 'Select',
459 ],
460 'pseudoconstant' => [
461 'callback' => 'CRM_Core_SelectValues::memberVisibility',
462 ],
463 ],
464 'weight' => [
465 'name' => 'weight',
466 'type' => CRM_Utils_Type::T_INT,
467 'title' => ts('Order'),
468 'where' => 'civicrm_membership_type.weight',
469 'table_name' => 'civicrm_membership_type',
470 'entity' => 'MembershipType',
471 'bao' => 'CRM_Member_BAO_MembershipType',
472 'localizable' => 0,
473 'html' => [
474 'type' => 'Text',
475 ],
476 ],
477 'receipt_text_signup' => [
478 'name' => 'receipt_text_signup',
479 'type' => CRM_Utils_Type::T_STRING,
480 'title' => ts('Membership Type Receipt Text'),
481 'description' => ts('Receipt Text for membership signup'),
482 'maxlength' => 255,
483 'size' => CRM_Utils_Type::HUGE,
484 'where' => 'civicrm_membership_type.receipt_text_signup',
485 'table_name' => 'civicrm_membership_type',
486 'entity' => 'MembershipType',
487 'bao' => 'CRM_Member_BAO_MembershipType',
488 'localizable' => 0,
489 'html' => [
490 'type' => 'TextArea',
491 ],
492 ],
493 'receipt_text_renewal' => [
494 'name' => 'receipt_text_renewal',
495 'type' => CRM_Utils_Type::T_STRING,
496 'title' => ts('Membership Type Renewal Text'),
497 'description' => ts('Receipt Text for membership renewal'),
498 'maxlength' => 255,
499 'size' => CRM_Utils_Type::HUGE,
500 'where' => 'civicrm_membership_type.receipt_text_renewal',
501 'table_name' => 'civicrm_membership_type',
502 'entity' => 'MembershipType',
503 'bao' => 'CRM_Member_BAO_MembershipType',
504 'localizable' => 0,
505 'html' => [
506 'type' => 'TextArea',
507 ],
508 ],
509 'auto_renew' => [
510 'name' => 'auto_renew',
511 'type' => CRM_Utils_Type::T_BOOLEAN,
512 'title' => ts('Auto Renew'),
513 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
514 'where' => 'civicrm_membership_type.auto_renew',
515 'default' => '0',
516 'table_name' => 'civicrm_membership_type',
517 'entity' => 'MembershipType',
518 'bao' => 'CRM_Member_BAO_MembershipType',
519 'localizable' => 0,
520 'html' => [
521 'type' => 'Radio',
522 ],
523 'pseudoconstant' => [
524 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
525 ],
526 ],
527 'is_active' => [
528 'name' => 'is_active',
529 'type' => CRM_Utils_Type::T_BOOLEAN,
530 'title' => ts('Is Active'),
531 'description' => ts('Is this membership_type enabled'),
532 'where' => 'civicrm_membership_type.is_active',
533 'default' => '1',
534 'table_name' => 'civicrm_membership_type',
535 'entity' => 'MembershipType',
536 'bao' => 'CRM_Member_BAO_MembershipType',
537 'localizable' => 0,
538 'html' => [
539 'type' => 'CheckBox',
540 'label' => ts("Enabled?"),
541 ],
542 ],
543 ];
544 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
545 }
546 return Civi::$statics[__CLASS__]['fields'];
547 }
548
549 /**
550 * Return a mapping from field-name to the corresponding key (as used in fields()).
551 *
552 * @return array
553 * Array(string $name => string $uniqueName).
554 */
555 public static function &fieldKeys() {
556 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
557 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
558 }
559 return Civi::$statics[__CLASS__]['fieldKeys'];
560 }
561
562 /**
563 * Returns the names of this table
564 *
565 * @return string
566 */
567 public static function getTableName() {
568 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
569 }
570
571 /**
572 * Returns if this table needs to be logged
573 *
574 * @return bool
575 */
576 public function getLog() {
577 return self::$_log;
578 }
579
580 /**
581 * Returns the list of fields that can be imported
582 *
583 * @param bool $prefix
584 *
585 * @return array
586 */
587 public static function &import($prefix = FALSE) {
588 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_type', $prefix, []);
589 return $r;
590 }
591
592 /**
593 * Returns the list of fields that can be exported
594 *
595 * @param bool $prefix
596 *
597 * @return array
598 */
599 public static function &export($prefix = FALSE) {
600 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_type', $prefix, []);
601 return $r;
602 }
603
604 /**
605 * Returns the list of indices
606 *
607 * @param bool $localize
608 *
609 * @return array
610 */
611 public static function indices($localize = TRUE) {
612 $indices = [
613 'index_relationship_type_id' => [
614 'name' => 'index_relationship_type_id',
615 'field' => [
616 0 => 'relationship_type_id',
617 ],
618 'localizable' => FALSE,
619 'sig' => 'civicrm_membership_type::0::relationship_type_id',
620 ],
621 ];
622 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
623 }
624
625 }