Merge pull request #19570 from colemanw/deleteOldXml
[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
c23563e3 9 * (GenCodeChecksum:af39fa64c6d191dcc6c1fc2c627b38fd)
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 ],
a9d0587b 184 'add' => '1.5',
c3fc2621
CW
185 ],
186 'membership_status' => [
e501603b
TO
187 'name' => 'name',
188 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 189 'title' => ts('Membership Status'),
215b423e 190 'description' => ts('Name for Membership Status'),
e501603b
TO
191 'maxlength' => 128,
192 'size' => CRM_Utils_Type::HUGE,
c3fc2621 193 'import' => TRUE,
e501603b 194 'where' => 'civicrm_membership_status.name',
c3fc2621 195 'export' => TRUE,
522a26c9 196 'table_name' => 'civicrm_membership_status',
197 'entity' => 'MembershipStatus',
198 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 199 'localizable' => 0,
a9d0587b 200 'add' => '1.5',
c3fc2621
CW
201 ],
202 'label' => [
e501603b
TO
203 'name' => 'label',
204 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 205 'title' => ts('Label'),
215b423e 206 'description' => ts('Label for Membership Status'),
e501603b
TO
207 'maxlength' => 128,
208 'size' => CRM_Utils_Type::HUGE,
a36434b9 209 'where' => 'civicrm_membership_status.label',
522a26c9 210 'table_name' => 'civicrm_membership_status',
211 'entity' => 'MembershipStatus',
212 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 213 'localizable' => 1,
3a0ba1c5 214 'html' => [
215 'type' => 'Text',
216 ],
a9d0587b 217 'add' => '3.2',
c3fc2621
CW
218 ],
219 'start_event' => [
e501603b
TO
220 'name' => 'start_event',
221 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 222 'title' => ts('Start Event'),
215b423e 223 'description' => ts('Event when this status starts.'),
e501603b
TO
224 'maxlength' => 12,
225 'size' => CRM_Utils_Type::TWELVE,
a36434b9 226 'where' => 'civicrm_membership_status.start_event',
522a26c9 227 'table_name' => 'civicrm_membership_status',
228 'entity' => 'MembershipStatus',
229 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 230 'localizable' => 0,
c3fc2621 231 'html' => [
e501603b 232 'type' => 'Select',
c23563e3 233 'label' => ts("Start Event"),
c3fc2621
CW
234 ],
235 'pseudoconstant' => [
e501603b 236 'callback' => 'CRM_Core_SelectValues::eventDate',
e6ca0a57 237 ],
a9d0587b 238 'add' => '1.5',
c3fc2621
CW
239 ],
240 'start_event_adjust_unit' => [
e501603b
TO
241 'name' => 'start_event_adjust_unit',
242 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 243 'title' => ts('Start Event Adjust Unit'),
215b423e 244 'description' => ts('Unit used for adjusting from start_event.'),
e501603b
TO
245 'maxlength' => 8,
246 'size' => CRM_Utils_Type::EIGHT,
a36434b9 247 'where' => 'civicrm_membership_status.start_event_adjust_unit',
522a26c9 248 'table_name' => 'civicrm_membership_status',
249 'entity' => 'MembershipStatus',
250 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 251 'localizable' => 0,
c3fc2621 252 'html' => [
e501603b 253 'type' => 'Select',
c23563e3 254 'label' => ts("Start Event Adjust Unit"),
c3fc2621
CW
255 ],
256 'pseudoconstant' => [
e501603b 257 'callback' => 'CRM_Core_SelectValues::unitList',
e6ca0a57 258 ],
a9d0587b 259 'add' => '1.5',
c3fc2621
CW
260 ],
261 'start_event_adjust_interval' => [
e501603b
TO
262 'name' => 'start_event_adjust_interval',
263 'type' => CRM_Utils_Type::T_INT,
c3fc2621 264 'title' => ts('Start Event Adjust Interval'),
215b423e 265 'description' => ts('Status range begins this many units from start_event.'),
a36434b9 266 'where' => 'civicrm_membership_status.start_event_adjust_interval',
522a26c9 267 'table_name' => 'civicrm_membership_status',
268 'entity' => 'MembershipStatus',
269 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 270 'localizable' => 0,
c23563e3
SL
271 'html' => [
272 'label' => ts("Start Event Adjust Interval"),
273 ],
a9d0587b 274 'add' => '1.5',
c3fc2621
CW
275 ],
276 'end_event' => [
e501603b
TO
277 'name' => 'end_event',
278 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 279 'title' => ts('End Event'),
215b423e 280 'description' => ts('Event after which this status ends.'),
e501603b
TO
281 'maxlength' => 12,
282 'size' => CRM_Utils_Type::TWELVE,
a36434b9 283 'where' => 'civicrm_membership_status.end_event',
522a26c9 284 'table_name' => 'civicrm_membership_status',
285 'entity' => 'MembershipStatus',
286 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 287 'localizable' => 0,
c3fc2621 288 'html' => [
e501603b 289 'type' => 'Select',
c23563e3 290 'label' => ts("End Event"),
c3fc2621
CW
291 ],
292 'pseudoconstant' => [
e501603b 293 'callback' => 'CRM_Core_SelectValues::eventDate',
e6ca0a57 294 ],
a9d0587b 295 'add' => '1.5',
c3fc2621
CW
296 ],
297 'end_event_adjust_unit' => [
e501603b
TO
298 'name' => 'end_event_adjust_unit',
299 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 300 'title' => ts('End Event Adjust Unit'),
215b423e 301 'description' => ts('Unit used for adjusting from the ending event.'),
e501603b
TO
302 'maxlength' => 8,
303 'size' => CRM_Utils_Type::EIGHT,
a36434b9 304 'where' => 'civicrm_membership_status.end_event_adjust_unit',
522a26c9 305 'table_name' => 'civicrm_membership_status',
306 'entity' => 'MembershipStatus',
307 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 308 'localizable' => 0,
c3fc2621 309 'html' => [
e501603b 310 'type' => 'Select',
c23563e3 311 'label' => ts("End Event Adjust Unit"),
c3fc2621
CW
312 ],
313 'pseudoconstant' => [
e501603b 314 'callback' => 'CRM_Core_SelectValues::unitList',
e6ca0a57 315 ],
a9d0587b 316 'add' => '1.5',
c3fc2621
CW
317 ],
318 'end_event_adjust_interval' => [
e501603b
TO
319 'name' => 'end_event_adjust_interval',
320 'type' => CRM_Utils_Type::T_INT,
c3fc2621 321 'title' => ts('End Event Adjust Interval'),
215b423e 322 'description' => ts('Status range ends this many units from end_event.'),
a36434b9 323 'where' => 'civicrm_membership_status.end_event_adjust_interval',
522a26c9 324 'table_name' => 'civicrm_membership_status',
325 'entity' => 'MembershipStatus',
326 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 327 'localizable' => 0,
c23563e3
SL
328 'html' => [
329 'label' => ts("End Event Adjust Interval"),
330 ],
a9d0587b 331 'add' => '1.5',
c3fc2621
CW
332 ],
333 'is_current_member' => [
e501603b
TO
334 'name' => 'is_current_member',
335 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 336 'title' => ts('Current Membership?'),
215b423e 337 '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 338 'where' => 'civicrm_membership_status.is_current_member',
522a26c9 339 'table_name' => 'civicrm_membership_status',
340 'entity' => 'MembershipStatus',
341 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 342 'localizable' => 0,
a9d0587b 343 'add' => '1.5',
c3fc2621
CW
344 ],
345 'is_admin' => [
e501603b
TO
346 'name' => 'is_admin',
347 'type' => CRM_Utils_Type::T_BOOLEAN,
3a0ba1c5 348 'title' => ts('Administrator Only?'),
215b423e 349 'description' => ts('Is this status for admin/manual assignment only.'),
a36434b9 350 'where' => 'civicrm_membership_status.is_admin',
522a26c9 351 'table_name' => 'civicrm_membership_status',
352 'entity' => 'MembershipStatus',
353 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 354 'localizable' => 0,
3a0ba1c5 355 'html' => [
356 'type' => 'CheckBox',
357 ],
a9d0587b 358 'add' => '1.5',
c3fc2621
CW
359 ],
360 'weight' => [
e501603b
TO
361 'name' => 'weight',
362 'type' => CRM_Utils_Type::T_INT,
c3fc2621 363 'title' => ts('Order'),
a36434b9 364 'where' => 'civicrm_membership_status.weight',
522a26c9 365 'table_name' => 'civicrm_membership_status',
366 'entity' => 'MembershipStatus',
367 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 368 'localizable' => 0,
a9d0587b 369 'add' => '1.5',
c3fc2621
CW
370 ],
371 'is_default' => [
e501603b
TO
372 'name' => 'is_default',
373 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 374 'title' => ts('Default Status?'),
215b423e 375 'description' => ts('Assign this status to a membership record if no other status match is found.'),
a36434b9 376 'where' => 'civicrm_membership_status.is_default',
522a26c9 377 'table_name' => 'civicrm_membership_status',
378 'entity' => 'MembershipStatus',
379 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 380 'localizable' => 0,
3a0ba1c5 381 'html' => [
382 'type' => 'CheckBox',
383 ],
a9d0587b 384 'add' => '1.5',
c3fc2621
CW
385 ],
386 'is_active' => [
e501603b
TO
387 'name' => 'is_active',
388 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 389 'title' => ts('Is Active'),
215b423e 390 'description' => ts('Is this membership_status enabled.'),
a36434b9 391 'where' => 'civicrm_membership_status.is_active',
e501603b 392 'default' => '1',
522a26c9 393 'table_name' => 'civicrm_membership_status',
394 'entity' => 'MembershipStatus',
395 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 396 'localizable' => 0,
3a0ba1c5 397 'html' => [
398 'type' => 'CheckBox',
399 ],
a9d0587b 400 'add' => '1.5',
c3fc2621
CW
401 ],
402 'is_reserved' => [
e501603b
TO
403 'name' => 'is_reserved',
404 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 405 'title' => ts('Is Reserved'),
215b423e 406 'description' => ts('Is this membership_status reserved.'),
a36434b9 407 'where' => 'civicrm_membership_status.is_reserved',
45a83e42 408 'default' => '0',
522a26c9 409 'table_name' => 'civicrm_membership_status',
410 'entity' => 'MembershipStatus',
411 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 412 'localizable' => 0,
3a0ba1c5 413 'html' => [
414 'type' => 'CheckBox',
415 ],
a9d0587b 416 'add' => '2.1',
c3fc2621
CW
417 ],
418 ];
346aaaba 419 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 420 }
346aaaba 421 return Civi::$statics[__CLASS__]['fields'];
e501603b 422 }
c3fc2621 423
e501603b 424 /**
bd8e0b14 425 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
426 *
427 * @return array
bd8e0b14 428 * Array(string $name => string $uniqueName).
e501603b 429 */
c3fc2621 430 public static function &fieldKeys() {
bd8e0b14
TO
431 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
432 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 433 }
bd8e0b14 434 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 435 }
c3fc2621 436
e501603b
TO
437 /**
438 * Returns the names of this table
439 *
440 * @return string
441 */
c3fc2621 442 public static function getTableName() {
e501603b
TO
443 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
444 }
c3fc2621 445
e501603b
TO
446 /**
447 * Returns if this table needs to be logged
448 *
c3fc2621 449 * @return bool
e501603b 450 */
c3fc2621 451 public function getLog() {
e501603b
TO
452 return self::$_log;
453 }
c3fc2621 454
e501603b
TO
455 /**
456 * Returns the list of fields that can be imported
457 *
458 * @param bool $prefix
459 *
460 * @return array
461 */
c3fc2621
CW
462 public static function &import($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, []);
60808919 464 return $r;
e501603b 465 }
c3fc2621 466
e501603b
TO
467 /**
468 * Returns the list of fields that can be exported
469 *
470 * @param bool $prefix
471 *
472 * @return array
473 */
c3fc2621
CW
474 public static function &export($prefix = FALSE) {
475 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, []);
60808919 476 return $r;
e501603b 477 }
c3fc2621 478
e7a6b91a
AS
479 /**
480 * Returns the list of indices
c3fc2621
CW
481 *
482 * @param bool $localize
483 *
484 * @return array
e7a6b91a
AS
485 */
486 public static function indices($localize = TRUE) {
c3fc2621 487 $indices = [];
e7a6b91a
AS
488 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
489 }
c3fc2621 490
e501603b 491}