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