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