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