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