Merge branch '5.11' of https://github.com/civicrm/civicrm-core
[civicrm-core.git] / CRM / Member / DAO / MembershipStatus.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Member/MembershipStatus.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:125e59b6c34bc9ea478a12c18a66af01)
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 */
22 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 */
c3fc2621
CW
29 static $_log = TRUE;
30
e501603b
TO
31 /**
32 * Membership Id
33 *
34 * @var int unsigned
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 *
97 * @var boolean
98 */
99 public $is_current_member;
c3fc2621 100
e501603b
TO
101 /**
102 * Is this status for admin/manual assignment only.
103 *
104 * @var boolean
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 *
116 * @var boolean
117 */
118 public $is_default;
c3fc2621 119
e501603b
TO
120 /**
121 * Is this membership_status enabled.
122 *
123 * @var boolean
124 */
125 public $is_active;
c3fc2621 126
e501603b
TO
127 /**
128 * Is this membership_status reserved.
129 *
130 * @var boolean
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,
522a26c9 156 'table_name' => 'civicrm_membership_status',
157 'entity' => 'MembershipStatus',
158 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 159 'localizable' => 0,
c3fc2621
CW
160 ],
161 'membership_status' => [
e501603b
TO
162 'name' => 'name',
163 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 164 'title' => ts('Membership Status'),
215b423e 165 'description' => ts('Name for Membership Status'),
e501603b
TO
166 'maxlength' => 128,
167 'size' => CRM_Utils_Type::HUGE,
c3fc2621 168 'import' => TRUE,
e501603b
TO
169 'where' => 'civicrm_membership_status.name',
170 'headerPattern' => '',
171 'dataPattern' => '',
c3fc2621 172 'export' => TRUE,
522a26c9 173 'table_name' => 'civicrm_membership_status',
174 'entity' => 'MembershipStatus',
175 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 176 'localizable' => 0,
c3fc2621
CW
177 ],
178 'label' => [
e501603b
TO
179 'name' => 'label',
180 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 181 'title' => ts('Label'),
215b423e 182 'description' => ts('Label for Membership Status'),
e501603b
TO
183 'maxlength' => 128,
184 'size' => CRM_Utils_Type::HUGE,
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,
522a26c9 200 'table_name' => 'civicrm_membership_status',
201 'entity' => 'MembershipStatus',
202 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 203 'localizable' => 0,
c3fc2621 204 'html' => [
e501603b 205 'type' => 'Select',
c3fc2621
CW
206 ],
207 'pseudoconstant' => [
e501603b 208 'callback' => 'CRM_Core_SelectValues::eventDate',
c3fc2621
CW
209 ]
210 ],
211 'start_event_adjust_unit' => [
e501603b
TO
212 'name' => 'start_event_adjust_unit',
213 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 214 'title' => ts('Start Event Adjust Unit'),
215b423e 215 'description' => ts('Unit used for adjusting from start_event.'),
e501603b
TO
216 'maxlength' => 8,
217 'size' => CRM_Utils_Type::EIGHT,
522a26c9 218 'table_name' => 'civicrm_membership_status',
219 'entity' => 'MembershipStatus',
220 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 221 'localizable' => 0,
c3fc2621 222 'html' => [
e501603b 223 'type' => 'Select',
c3fc2621
CW
224 ],
225 'pseudoconstant' => [
e501603b 226 'callback' => 'CRM_Core_SelectValues::unitList',
c3fc2621
CW
227 ]
228 ],
229 'start_event_adjust_interval' => [
e501603b
TO
230 'name' => 'start_event_adjust_interval',
231 'type' => CRM_Utils_Type::T_INT,
c3fc2621 232 'title' => ts('Start Event Adjust Interval'),
215b423e 233 'description' => ts('Status range begins this many units from start_event.'),
522a26c9 234 'table_name' => 'civicrm_membership_status',
235 'entity' => 'MembershipStatus',
236 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 237 'localizable' => 0,
c3fc2621
CW
238 ],
239 'end_event' => [
e501603b
TO
240 'name' => 'end_event',
241 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 242 'title' => ts('End Event'),
215b423e 243 'description' => ts('Event after which this status ends.'),
e501603b
TO
244 'maxlength' => 12,
245 'size' => CRM_Utils_Type::TWELVE,
522a26c9 246 'table_name' => 'civicrm_membership_status',
247 'entity' => 'MembershipStatus',
248 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 249 'localizable' => 0,
c3fc2621 250 'html' => [
e501603b 251 'type' => 'Select',
c3fc2621
CW
252 ],
253 'pseudoconstant' => [
e501603b 254 'callback' => 'CRM_Core_SelectValues::eventDate',
c3fc2621
CW
255 ]
256 ],
257 'end_event_adjust_unit' => [
e501603b
TO
258 'name' => 'end_event_adjust_unit',
259 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 260 'title' => ts('End Event Adjust Unit'),
215b423e 261 'description' => ts('Unit used for adjusting from the ending event.'),
e501603b
TO
262 'maxlength' => 8,
263 'size' => CRM_Utils_Type::EIGHT,
522a26c9 264 'table_name' => 'civicrm_membership_status',
265 'entity' => 'MembershipStatus',
266 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 267 'localizable' => 0,
c3fc2621 268 'html' => [
e501603b 269 'type' => 'Select',
c3fc2621
CW
270 ],
271 'pseudoconstant' => [
e501603b 272 'callback' => 'CRM_Core_SelectValues::unitList',
c3fc2621
CW
273 ]
274 ],
275 'end_event_adjust_interval' => [
e501603b
TO
276 'name' => 'end_event_adjust_interval',
277 'type' => CRM_Utils_Type::T_INT,
c3fc2621 278 'title' => ts('End Event Adjust Interval'),
215b423e 279 'description' => ts('Status range ends this many units from end_event.'),
522a26c9 280 'table_name' => 'civicrm_membership_status',
281 'entity' => 'MembershipStatus',
282 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 283 'localizable' => 0,
c3fc2621
CW
284 ],
285 'is_current_member' => [
e501603b
TO
286 'name' => 'is_current_member',
287 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 288 'title' => ts('Current Membership?'),
215b423e 289 '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).'),
522a26c9 290 'table_name' => 'civicrm_membership_status',
291 'entity' => 'MembershipStatus',
292 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 293 'localizable' => 0,
c3fc2621
CW
294 ],
295 'is_admin' => [
e501603b
TO
296 'name' => 'is_admin',
297 'type' => CRM_Utils_Type::T_BOOLEAN,
3a0ba1c5 298 'title' => ts('Administrator Only?'),
215b423e 299 'description' => ts('Is this status for admin/manual assignment only.'),
522a26c9 300 'table_name' => 'civicrm_membership_status',
301 'entity' => 'MembershipStatus',
302 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 303 'localizable' => 0,
3a0ba1c5 304 'html' => [
305 'type' => 'CheckBox',
306 ],
c3fc2621
CW
307 ],
308 'weight' => [
e501603b
TO
309 'name' => 'weight',
310 'type' => CRM_Utils_Type::T_INT,
c3fc2621 311 'title' => ts('Order'),
522a26c9 312 'table_name' => 'civicrm_membership_status',
313 'entity' => 'MembershipStatus',
314 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 315 'localizable' => 0,
c3fc2621
CW
316 ],
317 'is_default' => [
e501603b
TO
318 'name' => 'is_default',
319 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 320 'title' => ts('Default Status?'),
215b423e 321 'description' => ts('Assign this status to a membership record if no other status match is found.'),
522a26c9 322 'table_name' => 'civicrm_membership_status',
323 'entity' => 'MembershipStatus',
324 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 325 'localizable' => 0,
3a0ba1c5 326 'html' => [
327 'type' => 'CheckBox',
328 ],
c3fc2621
CW
329 ],
330 'is_active' => [
e501603b
TO
331 'name' => 'is_active',
332 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 333 'title' => ts('Is Active'),
215b423e 334 'description' => ts('Is this membership_status enabled.'),
e501603b 335 'default' => '1',
522a26c9 336 'table_name' => 'civicrm_membership_status',
337 'entity' => 'MembershipStatus',
338 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 339 'localizable' => 0,
3a0ba1c5 340 'html' => [
341 'type' => 'CheckBox',
342 ],
c3fc2621
CW
343 ],
344 'is_reserved' => [
e501603b
TO
345 'name' => 'is_reserved',
346 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 347 'title' => ts('Is Reserved'),
215b423e 348 'description' => ts('Is this membership_status reserved.'),
45a83e42 349 'default' => '0',
522a26c9 350 'table_name' => 'civicrm_membership_status',
351 'entity' => 'MembershipStatus',
352 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 353 'localizable' => 0,
3a0ba1c5 354 'html' => [
355 'type' => 'CheckBox',
356 ],
c3fc2621
CW
357 ],
358 ];
346aaaba 359 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 360 }
346aaaba 361 return Civi::$statics[__CLASS__]['fields'];
e501603b 362 }
c3fc2621 363
e501603b 364 /**
bd8e0b14 365 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
366 *
367 * @return array
bd8e0b14 368 * Array(string $name => string $uniqueName).
e501603b 369 */
c3fc2621 370 public static function &fieldKeys() {
bd8e0b14
TO
371 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
372 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 373 }
bd8e0b14 374 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 375 }
c3fc2621 376
e501603b
TO
377 /**
378 * Returns the names of this table
379 *
380 * @return string
381 */
c3fc2621 382 public static function getTableName() {
e501603b
TO
383 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
384 }
c3fc2621 385
e501603b
TO
386 /**
387 * Returns if this table needs to be logged
388 *
c3fc2621 389 * @return bool
e501603b 390 */
c3fc2621 391 public function getLog() {
e501603b
TO
392 return self::$_log;
393 }
c3fc2621 394
e501603b
TO
395 /**
396 * Returns the list of fields that can be imported
397 *
398 * @param bool $prefix
399 *
400 * @return array
401 */
c3fc2621
CW
402 public static function &import($prefix = FALSE) {
403 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, []);
60808919 404 return $r;
e501603b 405 }
c3fc2621 406
e501603b
TO
407 /**
408 * Returns the list of fields that can be exported
409 *
410 * @param bool $prefix
411 *
412 * @return array
413 */
c3fc2621
CW
414 public static function &export($prefix = FALSE) {
415 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, []);
60808919 416 return $r;
e501603b 417 }
c3fc2621 418
e7a6b91a
AS
419 /**
420 * Returns the list of indices
c3fc2621
CW
421 *
422 * @param bool $localize
423 *
424 * @return array
e7a6b91a
AS
425 */
426 public static function indices($localize = TRUE) {
c3fc2621 427 $indices = [];
e7a6b91a
AS
428 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
429 }
c3fc2621 430
e501603b 431}