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