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