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