Merge pull request #23947 from totten/master-php81-global
[civicrm-core.git] / CRM / Member / DAO / MembershipStatus.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/MembershipStatus.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
c1e814c7 9 * (GenCodeChecksum:baf51df46a12becf1b8ed3f8a25e2237)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MembershipStatus entity.
f41f0342 14 */
e501603b 15class CRM_Member_DAO_MembershipStatus 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_status';
c3fc2621 26
8ab43c93
CW
27 /**
28 * Field to show when displaying a record.
29 *
30 * @var string
31 */
32 public static $_labelField = 'label';
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 * Name for Membership Status
52 *
53 * @var string
28979d65
CW
54 * (SQL type: varchar(128))
55 * Note that values will be retrieved from the database as a string.
e501603b
TO
56 */
57 public $name;
c3fc2621 58
e501603b
TO
59 /**
60 * Label for Membership Status
61 *
28979d65
CW
62 * @var string|null
63 * (SQL type: varchar(128))
64 * Note that values will be retrieved from the database as a string.
e501603b
TO
65 */
66 public $label;
c3fc2621 67
e501603b
TO
68 /**
69 * Event when this status starts.
70 *
28979d65
CW
71 * @var string|null
72 * (SQL type: varchar(12))
73 * Note that values will be retrieved from the database as a string.
e501603b
TO
74 */
75 public $start_event;
c3fc2621 76
e501603b
TO
77 /**
78 * Unit used for adjusting from start_event.
79 *
28979d65
CW
80 * @var string|null
81 * (SQL type: varchar(8))
82 * Note that values will be retrieved from the database as a string.
e501603b
TO
83 */
84 public $start_event_adjust_unit;
c3fc2621 85
e501603b
TO
86 /**
87 * Status range begins this many units from start_event.
88 *
28979d65
CW
89 * @var int|string|null
90 * (SQL type: int)
91 * Note that values will be retrieved from the database as a string.
e501603b
TO
92 */
93 public $start_event_adjust_interval;
c3fc2621 94
e501603b
TO
95 /**
96 * Event after which this status ends.
97 *
28979d65
CW
98 * @var string|null
99 * (SQL type: varchar(12))
100 * Note that values will be retrieved from the database as a string.
e501603b
TO
101 */
102 public $end_event;
c3fc2621 103
e501603b
TO
104 /**
105 * Unit used for adjusting from the ending event.
106 *
28979d65
CW
107 * @var string|null
108 * (SQL type: varchar(8))
109 * Note that values will be retrieved from the database as a string.
e501603b
TO
110 */
111 public $end_event_adjust_unit;
c3fc2621 112
e501603b
TO
113 /**
114 * Status range ends this many units from end_event.
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 $end_event_adjust_interval;
c3fc2621 121
e501603b
TO
122 /**
123 * Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).
124 *
c1e814c7 125 * @var bool|string
28979d65
CW
126 * (SQL type: tinyint)
127 * Note that values will be retrieved from the database as a string.
e501603b
TO
128 */
129 public $is_current_member;
c3fc2621 130
e501603b
TO
131 /**
132 * Is this status for admin/manual assignment only.
133 *
c1e814c7 134 * @var bool|string
28979d65
CW
135 * (SQL type: tinyint)
136 * Note that values will be retrieved from the database as a string.
e501603b
TO
137 */
138 public $is_admin;
c3fc2621 139
e501603b 140 /**
28979d65
CW
141 * @var int|string|null
142 * (SQL type: int)
143 * Note that values will be retrieved from the database as a string.
e501603b
TO
144 */
145 public $weight;
c3fc2621 146
e501603b
TO
147 /**
148 * Assign this status to a membership record if no other status match is found.
149 *
c1e814c7 150 * @var bool|string
28979d65
CW
151 * (SQL type: tinyint)
152 * Note that values will be retrieved from the database as a string.
e501603b
TO
153 */
154 public $is_default;
c3fc2621 155
e501603b
TO
156 /**
157 * Is this membership_status enabled.
158 *
c1e814c7 159 * @var bool|string
28979d65
CW
160 * (SQL type: tinyint)
161 * Note that values will be retrieved from the database as a string.
e501603b
TO
162 */
163 public $is_active;
c3fc2621 164
e501603b
TO
165 /**
166 * Is this membership_status reserved.
167 *
c1e814c7 168 * @var bool|string
28979d65
CW
169 * (SQL type: tinyint)
170 * Note that values will be retrieved from the database as a string.
e501603b
TO
171 */
172 public $is_reserved;
c3fc2621 173
e501603b 174 /**
f41f0342 175 * Class constructor.
e501603b 176 */
c3fc2621 177 public function __construct() {
e501603b
TO
178 $this->__table = 'civicrm_membership_status';
179 parent::__construct();
180 }
c3fc2621 181
449c4e6b
CW
182 /**
183 * Returns localized title of this entity.
7b66c3b5
AH
184 *
185 * @param bool $plural
186 * Whether to return the plural version of the title.
449c4e6b 187 */
7b66c3b5
AH
188 public static function getEntityTitle($plural = FALSE) {
189 return $plural ? ts('Membership Statuses') : ts('Membership Status');
449c4e6b
CW
190 }
191
e501603b
TO
192 /**
193 * Returns all the column names of this table
194 *
195 * @return array
196 */
c3fc2621 197 public static function &fields() {
346aaaba 198 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
199 Civi::$statics[__CLASS__]['fields'] = [
200 'id' => [
e501603b
TO
201 'name' => 'id',
202 'type' => CRM_Utils_Type::T_INT,
c3fc2621 203 'title' => ts('Membership Status ID'),
2cbbebe8 204 'description' => ts('Membership ID'),
c3fc2621 205 'required' => TRUE,
a36434b9 206 'where' => 'civicrm_membership_status.id',
522a26c9 207 'table_name' => 'civicrm_membership_status',
208 'entity' => 'MembershipStatus',
209 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 210 'localizable' => 0,
2cbbebe8
A
211 'html' => [
212 'type' => 'Number',
213 ],
1fe423d6 214 'readonly' => TRUE,
a9d0587b 215 'add' => '1.5',
c3fc2621
CW
216 ],
217 'membership_status' => [
e501603b
TO
218 'name' => 'name',
219 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 220 'title' => ts('Membership Status'),
215b423e 221 'description' => ts('Name for Membership Status'),
495f49d4 222 'required' => TRUE,
e501603b
TO
223 'maxlength' => 128,
224 'size' => CRM_Utils_Type::HUGE,
c3fc2621 225 'import' => TRUE,
e501603b 226 'where' => 'civicrm_membership_status.name',
c3fc2621 227 'export' => TRUE,
522a26c9 228 'table_name' => 'civicrm_membership_status',
229 'entity' => 'MembershipStatus',
230 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 231 'localizable' => 0,
a9d0587b 232 'add' => '1.5',
c3fc2621
CW
233 ],
234 'label' => [
e501603b
TO
235 'name' => 'label',
236 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 237 'title' => ts('Label'),
215b423e 238 'description' => ts('Label for Membership Status'),
e501603b
TO
239 'maxlength' => 128,
240 'size' => CRM_Utils_Type::HUGE,
a36434b9 241 'where' => 'civicrm_membership_status.label',
522a26c9 242 'table_name' => 'civicrm_membership_status',
243 'entity' => 'MembershipStatus',
244 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 245 'localizable' => 1,
3a0ba1c5 246 'html' => [
247 'type' => 'Text',
248 ],
a9d0587b 249 'add' => '3.2',
c3fc2621
CW
250 ],
251 'start_event' => [
e501603b
TO
252 'name' => 'start_event',
253 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 254 'title' => ts('Start Event'),
215b423e 255 'description' => ts('Event when this status starts.'),
e501603b
TO
256 'maxlength' => 12,
257 'size' => CRM_Utils_Type::TWELVE,
a36434b9 258 'where' => 'civicrm_membership_status.start_event',
522a26c9 259 'table_name' => 'civicrm_membership_status',
260 'entity' => 'MembershipStatus',
261 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 262 'localizable' => 0,
c3fc2621 263 'html' => [
e501603b 264 'type' => 'Select',
c23563e3 265 'label' => ts("Start Event"),
c3fc2621
CW
266 ],
267 'pseudoconstant' => [
e501603b 268 'callback' => 'CRM_Core_SelectValues::eventDate',
e6ca0a57 269 ],
a9d0587b 270 'add' => '1.5',
c3fc2621
CW
271 ],
272 'start_event_adjust_unit' => [
e501603b
TO
273 'name' => 'start_event_adjust_unit',
274 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 275 'title' => ts('Start Event Adjust Unit'),
215b423e 276 'description' => ts('Unit used for adjusting from start_event.'),
e501603b
TO
277 'maxlength' => 8,
278 'size' => CRM_Utils_Type::EIGHT,
a36434b9 279 'where' => 'civicrm_membership_status.start_event_adjust_unit',
522a26c9 280 'table_name' => 'civicrm_membership_status',
281 'entity' => 'MembershipStatus',
282 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 283 'localizable' => 0,
c3fc2621 284 'html' => [
e501603b 285 'type' => 'Select',
c23563e3 286 'label' => ts("Start Event Adjust Unit"),
c3fc2621
CW
287 ],
288 'pseudoconstant' => [
e501603b 289 'callback' => 'CRM_Core_SelectValues::unitList',
e6ca0a57 290 ],
a9d0587b 291 'add' => '1.5',
c3fc2621
CW
292 ],
293 'start_event_adjust_interval' => [
e501603b
TO
294 'name' => 'start_event_adjust_interval',
295 'type' => CRM_Utils_Type::T_INT,
c3fc2621 296 'title' => ts('Start Event Adjust Interval'),
215b423e 297 'description' => ts('Status range begins this many units from start_event.'),
a36434b9 298 'where' => 'civicrm_membership_status.start_event_adjust_interval',
522a26c9 299 'table_name' => 'civicrm_membership_status',
300 'entity' => 'MembershipStatus',
301 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 302 'localizable' => 0,
c23563e3
SL
303 'html' => [
304 'label' => ts("Start Event Adjust Interval"),
305 ],
a9d0587b 306 'add' => '1.5',
c3fc2621
CW
307 ],
308 'end_event' => [
e501603b
TO
309 'name' => 'end_event',
310 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 311 'title' => ts('End Event'),
215b423e 312 'description' => ts('Event after which this status ends.'),
e501603b
TO
313 'maxlength' => 12,
314 'size' => CRM_Utils_Type::TWELVE,
a36434b9 315 'where' => 'civicrm_membership_status.end_event',
522a26c9 316 'table_name' => 'civicrm_membership_status',
317 'entity' => 'MembershipStatus',
318 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 319 'localizable' => 0,
c3fc2621 320 'html' => [
e501603b 321 'type' => 'Select',
c23563e3 322 'label' => ts("End Event"),
c3fc2621
CW
323 ],
324 'pseudoconstant' => [
e501603b 325 'callback' => 'CRM_Core_SelectValues::eventDate',
e6ca0a57 326 ],
a9d0587b 327 'add' => '1.5',
c3fc2621
CW
328 ],
329 'end_event_adjust_unit' => [
e501603b
TO
330 'name' => 'end_event_adjust_unit',
331 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 332 'title' => ts('End Event Adjust Unit'),
215b423e 333 'description' => ts('Unit used for adjusting from the ending event.'),
e501603b
TO
334 'maxlength' => 8,
335 'size' => CRM_Utils_Type::EIGHT,
a36434b9 336 'where' => 'civicrm_membership_status.end_event_adjust_unit',
522a26c9 337 'table_name' => 'civicrm_membership_status',
338 'entity' => 'MembershipStatus',
339 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 340 'localizable' => 0,
c3fc2621 341 'html' => [
e501603b 342 'type' => 'Select',
c23563e3 343 'label' => ts("End Event Adjust Unit"),
c3fc2621
CW
344 ],
345 'pseudoconstant' => [
e501603b 346 'callback' => 'CRM_Core_SelectValues::unitList',
e6ca0a57 347 ],
a9d0587b 348 'add' => '1.5',
c3fc2621
CW
349 ],
350 'end_event_adjust_interval' => [
e501603b
TO
351 'name' => 'end_event_adjust_interval',
352 'type' => CRM_Utils_Type::T_INT,
c3fc2621 353 'title' => ts('End Event Adjust Interval'),
215b423e 354 'description' => ts('Status range ends this many units from end_event.'),
a36434b9 355 'where' => 'civicrm_membership_status.end_event_adjust_interval',
522a26c9 356 'table_name' => 'civicrm_membership_status',
357 'entity' => 'MembershipStatus',
358 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 359 'localizable' => 0,
c23563e3
SL
360 'html' => [
361 'label' => ts("End Event Adjust Interval"),
362 ],
a9d0587b 363 'add' => '1.5',
c3fc2621
CW
364 ],
365 'is_current_member' => [
e501603b
TO
366 'name' => 'is_current_member',
367 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 368 'title' => ts('Current Membership?'),
215b423e 369 'description' => ts('Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).'),
c1e814c7 370 'required' => TRUE,
a36434b9 371 'where' => 'civicrm_membership_status.is_current_member',
c1e814c7 372 'default' => '0',
522a26c9 373 'table_name' => 'civicrm_membership_status',
374 'entity' => 'MembershipStatus',
375 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 376 'localizable' => 0,
a9d0587b 377 'add' => '1.5',
c3fc2621
CW
378 ],
379 'is_admin' => [
e501603b
TO
380 'name' => 'is_admin',
381 'type' => CRM_Utils_Type::T_BOOLEAN,
3a0ba1c5 382 'title' => ts('Administrator Only?'),
215b423e 383 'description' => ts('Is this status for admin/manual assignment only.'),
c1e814c7 384 'required' => TRUE,
a36434b9 385 'where' => 'civicrm_membership_status.is_admin',
c1e814c7 386 'default' => '0',
522a26c9 387 'table_name' => 'civicrm_membership_status',
388 'entity' => 'MembershipStatus',
389 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 390 'localizable' => 0,
3a0ba1c5 391 'html' => [
392 'type' => 'CheckBox',
393 ],
a9d0587b 394 'add' => '1.5',
c3fc2621
CW
395 ],
396 'weight' => [
e501603b
TO
397 'name' => 'weight',
398 'type' => CRM_Utils_Type::T_INT,
c3fc2621 399 'title' => ts('Order'),
a36434b9 400 'where' => 'civicrm_membership_status.weight',
522a26c9 401 'table_name' => 'civicrm_membership_status',
402 'entity' => 'MembershipStatus',
403 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 404 'localizable' => 0,
a9d0587b 405 'add' => '1.5',
c3fc2621
CW
406 ],
407 'is_default' => [
e501603b
TO
408 'name' => 'is_default',
409 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 410 'title' => ts('Default Status?'),
215b423e 411 'description' => ts('Assign this status to a membership record if no other status match is found.'),
c1e814c7 412 'required' => TRUE,
a36434b9 413 'where' => 'civicrm_membership_status.is_default',
c1e814c7 414 'default' => '0',
522a26c9 415 'table_name' => 'civicrm_membership_status',
416 'entity' => 'MembershipStatus',
417 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 418 'localizable' => 0,
3a0ba1c5 419 'html' => [
420 'type' => 'CheckBox',
421 ],
a9d0587b 422 'add' => '1.5',
c3fc2621
CW
423 ],
424 'is_active' => [
e501603b
TO
425 'name' => 'is_active',
426 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 427 'title' => ts('Is Active'),
215b423e 428 'description' => ts('Is this membership_status enabled.'),
c1e814c7 429 'required' => TRUE,
a36434b9 430 'where' => 'civicrm_membership_status.is_active',
e501603b 431 'default' => '1',
522a26c9 432 'table_name' => 'civicrm_membership_status',
433 'entity' => 'MembershipStatus',
434 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 435 'localizable' => 0,
3a0ba1c5 436 'html' => [
437 'type' => 'CheckBox',
438 ],
a9d0587b 439 'add' => '1.5',
c3fc2621
CW
440 ],
441 'is_reserved' => [
e501603b
TO
442 'name' => 'is_reserved',
443 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 444 'title' => ts('Is Reserved'),
215b423e 445 'description' => ts('Is this membership_status reserved.'),
c1e814c7 446 'required' => TRUE,
a36434b9 447 'where' => 'civicrm_membership_status.is_reserved',
45a83e42 448 'default' => '0',
522a26c9 449 'table_name' => 'civicrm_membership_status',
450 'entity' => 'MembershipStatus',
451 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 452 'localizable' => 0,
3a0ba1c5 453 'html' => [
454 'type' => 'CheckBox',
455 ],
a9d0587b 456 'add' => '2.1',
c3fc2621
CW
457 ],
458 ];
346aaaba 459 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 460 }
346aaaba 461 return Civi::$statics[__CLASS__]['fields'];
e501603b 462 }
c3fc2621 463
e501603b 464 /**
bd8e0b14 465 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
466 *
467 * @return array
bd8e0b14 468 * Array(string $name => string $uniqueName).
e501603b 469 */
c3fc2621 470 public static function &fieldKeys() {
bd8e0b14
TO
471 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
472 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 473 }
bd8e0b14 474 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 475 }
c3fc2621 476
e501603b
TO
477 /**
478 * Returns the names of this table
479 *
480 * @return string
481 */
c3fc2621 482 public static function getTableName() {
e501603b
TO
483 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
484 }
c3fc2621 485
e501603b
TO
486 /**
487 * Returns if this table needs to be logged
488 *
c3fc2621 489 * @return bool
e501603b 490 */
c3fc2621 491 public function getLog() {
e501603b
TO
492 return self::$_log;
493 }
c3fc2621 494
e501603b
TO
495 /**
496 * Returns the list of fields that can be imported
497 *
498 * @param bool $prefix
499 *
500 * @return array
501 */
c3fc2621
CW
502 public static function &import($prefix = FALSE) {
503 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, []);
60808919 504 return $r;
e501603b 505 }
c3fc2621 506
e501603b
TO
507 /**
508 * Returns the list of fields that can be exported
509 *
510 * @param bool $prefix
511 *
512 * @return array
513 */
c3fc2621
CW
514 public static function &export($prefix = FALSE) {
515 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, []);
60808919 516 return $r;
e501603b 517 }
c3fc2621 518
e7a6b91a
AS
519 /**
520 * Returns the list of indices
c3fc2621
CW
521 *
522 * @param bool $localize
523 *
524 * @return array
e7a6b91a
AS
525 */
526 public static function indices($localize = TRUE) {
c3fc2621 527 $indices = [];
e7a6b91a
AS
528 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
529 }
c3fc2621 530
e501603b 531}