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