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