Merge pull request #12174 from eileenmcnaughton/matt
[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
6a7e5e5d 9 * (GenCodeChecksum:dfe977e53a6b66703ab4eca3560048e6)
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,
c3fc2621
CW
189 ],
190 'start_event' => [
e501603b
TO
191 'name' => 'start_event',
192 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 193 'title' => ts('Start Event'),
e501603b
TO
194 'description' => 'Event when this status starts.',
195 'maxlength' => 12,
196 'size' => CRM_Utils_Type::TWELVE,
522a26c9 197 'table_name' => 'civicrm_membership_status',
198 'entity' => 'MembershipStatus',
199 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 200 'localizable' => 0,
c3fc2621 201 'html' => [
e501603b 202 'type' => 'Select',
c3fc2621
CW
203 ],
204 'pseudoconstant' => [
e501603b 205 'callback' => 'CRM_Core_SelectValues::eventDate',
c3fc2621
CW
206 ]
207 ],
208 'start_event_adjust_unit' => [
e501603b
TO
209 'name' => 'start_event_adjust_unit',
210 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 211 'title' => ts('Start Event Adjust Unit'),
e501603b
TO
212 'description' => 'Unit used for adjusting from start_event.',
213 'maxlength' => 8,
214 'size' => CRM_Utils_Type::EIGHT,
522a26c9 215 'table_name' => 'civicrm_membership_status',
216 'entity' => 'MembershipStatus',
217 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 218 'localizable' => 0,
c3fc2621 219 'html' => [
e501603b 220 'type' => 'Select',
c3fc2621
CW
221 ],
222 'pseudoconstant' => [
e501603b 223 'callback' => 'CRM_Core_SelectValues::unitList',
c3fc2621
CW
224 ]
225 ],
226 'start_event_adjust_interval' => [
e501603b
TO
227 'name' => 'start_event_adjust_interval',
228 'type' => CRM_Utils_Type::T_INT,
c3fc2621 229 'title' => ts('Start Event Adjust Interval'),
e501603b 230 'description' => 'Status range begins this many units from start_event.',
522a26c9 231 'table_name' => 'civicrm_membership_status',
232 'entity' => 'MembershipStatus',
233 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 234 'localizable' => 0,
c3fc2621
CW
235 ],
236 'end_event' => [
e501603b
TO
237 'name' => 'end_event',
238 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 239 'title' => ts('End Event'),
e501603b
TO
240 'description' => 'Event after which this status ends.',
241 'maxlength' => 12,
242 'size' => CRM_Utils_Type::TWELVE,
522a26c9 243 'table_name' => 'civicrm_membership_status',
244 'entity' => 'MembershipStatus',
245 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 246 'localizable' => 0,
c3fc2621 247 'html' => [
e501603b 248 'type' => 'Select',
c3fc2621
CW
249 ],
250 'pseudoconstant' => [
e501603b 251 'callback' => 'CRM_Core_SelectValues::eventDate',
c3fc2621
CW
252 ]
253 ],
254 'end_event_adjust_unit' => [
e501603b
TO
255 'name' => 'end_event_adjust_unit',
256 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 257 'title' => ts('End Event Adjust Unit'),
e501603b
TO
258 'description' => 'Unit used for adjusting from the ending event.',
259 'maxlength' => 8,
260 'size' => CRM_Utils_Type::EIGHT,
522a26c9 261 'table_name' => 'civicrm_membership_status',
262 'entity' => 'MembershipStatus',
263 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 264 'localizable' => 0,
c3fc2621 265 'html' => [
e501603b 266 'type' => 'Select',
c3fc2621
CW
267 ],
268 'pseudoconstant' => [
e501603b 269 'callback' => 'CRM_Core_SelectValues::unitList',
c3fc2621
CW
270 ]
271 ],
272 'end_event_adjust_interval' => [
e501603b
TO
273 'name' => 'end_event_adjust_interval',
274 'type' => CRM_Utils_Type::T_INT,
c3fc2621 275 'title' => ts('End Event Adjust Interval'),
e501603b 276 'description' => 'Status range ends this many units from end_event.',
522a26c9 277 'table_name' => 'civicrm_membership_status',
278 'entity' => 'MembershipStatus',
279 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 280 'localizable' => 0,
c3fc2621
CW
281 ],
282 'is_current_member' => [
e501603b
TO
283 'name' => 'is_current_member',
284 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 285 'title' => ts('Current Membership?'),
e501603b 286 '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 287 'table_name' => 'civicrm_membership_status',
288 'entity' => 'MembershipStatus',
289 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 290 'localizable' => 0,
c3fc2621
CW
291 ],
292 'is_admin' => [
e501603b
TO
293 'name' => 'is_admin',
294 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 295 'title' => ts('Admin Assigned Only?'),
e501603b 296 'description' => 'Is this status for admin/manual assignment only.',
522a26c9 297 'table_name' => 'civicrm_membership_status',
298 'entity' => 'MembershipStatus',
299 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 300 'localizable' => 0,
c3fc2621
CW
301 ],
302 'weight' => [
e501603b
TO
303 'name' => 'weight',
304 'type' => CRM_Utils_Type::T_INT,
c3fc2621 305 'title' => ts('Order'),
522a26c9 306 'table_name' => 'civicrm_membership_status',
307 'entity' => 'MembershipStatus',
308 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 309 'localizable' => 0,
c3fc2621
CW
310 ],
311 'is_default' => [
e501603b
TO
312 'name' => 'is_default',
313 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 314 'title' => ts('Default Status?'),
e501603b 315 'description' => 'Assign this status to a membership record if no other status match is found.',
522a26c9 316 'table_name' => 'civicrm_membership_status',
317 'entity' => 'MembershipStatus',
318 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 319 'localizable' => 0,
c3fc2621
CW
320 ],
321 'is_active' => [
e501603b
TO
322 'name' => 'is_active',
323 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 324 'title' => ts('Is Active'),
e501603b
TO
325 'description' => 'Is this membership_status enabled.',
326 'default' => '1',
522a26c9 327 'table_name' => 'civicrm_membership_status',
328 'entity' => 'MembershipStatus',
329 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 330 'localizable' => 0,
c3fc2621
CW
331 ],
332 'is_reserved' => [
e501603b
TO
333 'name' => 'is_reserved',
334 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 335 'title' => ts('Is Reserved'),
e501603b 336 'description' => 'Is this membership_status reserved.',
522a26c9 337 'table_name' => 'civicrm_membership_status',
338 'entity' => 'MembershipStatus',
339 'bao' => 'CRM_Member_BAO_MembershipStatus',
6a7e5e5d 340 'localizable' => 0,
c3fc2621
CW
341 ],
342 ];
346aaaba 343 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 344 }
346aaaba 345 return Civi::$statics[__CLASS__]['fields'];
e501603b 346 }
c3fc2621 347
e501603b 348 /**
bd8e0b14 349 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
350 *
351 * @return array
bd8e0b14 352 * Array(string $name => string $uniqueName).
e501603b 353 */
c3fc2621 354 public static function &fieldKeys() {
bd8e0b14
TO
355 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
356 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 357 }
bd8e0b14 358 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 359 }
c3fc2621 360
e501603b
TO
361 /**
362 * Returns the names of this table
363 *
364 * @return string
365 */
c3fc2621 366 public static function getTableName() {
e501603b
TO
367 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
368 }
c3fc2621 369
e501603b
TO
370 /**
371 * Returns if this table needs to be logged
372 *
c3fc2621 373 * @return bool
e501603b 374 */
c3fc2621 375 public function getLog() {
e501603b
TO
376 return self::$_log;
377 }
c3fc2621 378
e501603b
TO
379 /**
380 * Returns the list of fields that can be imported
381 *
382 * @param bool $prefix
383 *
384 * @return array
385 */
c3fc2621
CW
386 public static function &import($prefix = FALSE) {
387 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, []);
60808919 388 return $r;
e501603b 389 }
c3fc2621 390
e501603b
TO
391 /**
392 * Returns the list of fields that can be exported
393 *
394 * @param bool $prefix
395 *
396 * @return array
397 */
c3fc2621
CW
398 public static function &export($prefix = FALSE) {
399 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, []);
60808919 400 return $r;
e501603b 401 }
c3fc2621 402
e7a6b91a
AS
403 /**
404 * Returns the list of indices
c3fc2621
CW
405 *
406 * @param bool $localize
407 *
408 * @return array
e7a6b91a
AS
409 */
410 public static function indices($localize = TRUE) {
c3fc2621 411 $indices = [];
e7a6b91a
AS
412 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
413 }
c3fc2621 414
e501603b 415}