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