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