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