5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Member/MembershipStatus.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7a244bc9a0db34ad31adc004d97e1945)
13 * Database access object for the MembershipStatus entity.
15 class CRM_Member_DAO_MembershipStatus
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
18 const COMPONENT
= 'CiviMember';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_membership_status';
28 * Field to show when displaying a record.
32 public static $_labelField = 'label';
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = TRUE;
49 * Name for Membership Status
56 * Label for Membership Status
63 * Event when this status starts.
70 * Unit used for adjusting from start_event.
74 public $start_event_adjust_unit;
77 * Status range begins this many units from start_event.
81 public $start_event_adjust_interval;
84 * Event after which this status ends.
91 * Unit used for adjusting from the ending event.
95 public $end_event_adjust_unit;
98 * Status range ends this many units from end_event.
102 public $end_event_adjust_interval;
105 * Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).
109 public $is_current_member;
112 * Is this status for admin/manual assignment only.
124 * Assign this status to a membership record if no other status match is found.
131 * Is this membership_status enabled.
138 * Is this membership_status reserved.
147 public function __construct() {
148 $this->__table
= 'civicrm_membership_status';
149 parent
::__construct();
153 * Returns localized title of this entity.
155 * @param bool $plural
156 * Whether to return the plural version of the title.
158 public static function getEntityTitle($plural = FALSE) {
159 return $plural ?
ts('Membership Statuses') : ts('Membership Status');
163 * Returns all the column names of this table
167 public static function &fields() {
168 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
169 Civi
::$statics[__CLASS__
]['fields'] = [
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Membership Status ID'),
174 'description' => ts('Membership ID'),
176 'where' => 'civicrm_membership_status.id',
177 'table_name' => 'civicrm_membership_status',
178 'entity' => 'MembershipStatus',
179 'bao' => 'CRM_Member_BAO_MembershipStatus',
186 'membership_status' => [
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Membership Status'),
190 'description' => ts('Name for Membership Status'),
192 'size' => CRM_Utils_Type
::HUGE
,
194 'where' => 'civicrm_membership_status.name',
196 'table_name' => 'civicrm_membership_status',
197 'entity' => 'MembershipStatus',
198 'bao' => 'CRM_Member_BAO_MembershipStatus',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Label'),
206 'description' => ts('Label for Membership Status'),
208 'size' => CRM_Utils_Type
::HUGE
,
209 'where' => 'civicrm_membership_status.label',
210 'table_name' => 'civicrm_membership_status',
211 'entity' => 'MembershipStatus',
212 'bao' => 'CRM_Member_BAO_MembershipStatus',
220 'name' => 'start_event',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Start Event'),
223 'description' => ts('Event when this status starts.'),
225 'size' => CRM_Utils_Type
::TWELVE
,
226 'where' => 'civicrm_membership_status.start_event',
227 'table_name' => 'civicrm_membership_status',
228 'entity' => 'MembershipStatus',
229 'bao' => 'CRM_Member_BAO_MembershipStatus',
234 'pseudoconstant' => [
235 'callback' => 'CRM_Core_SelectValues::eventDate',
239 'start_event_adjust_unit' => [
240 'name' => 'start_event_adjust_unit',
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Start Event Adjust Unit'),
243 'description' => ts('Unit used for adjusting from start_event.'),
245 'size' => CRM_Utils_Type
::EIGHT
,
246 'where' => 'civicrm_membership_status.start_event_adjust_unit',
247 'table_name' => 'civicrm_membership_status',
248 'entity' => 'MembershipStatus',
249 'bao' => 'CRM_Member_BAO_MembershipStatus',
254 'pseudoconstant' => [
255 'callback' => 'CRM_Core_SelectValues::unitList',
259 'start_event_adjust_interval' => [
260 'name' => 'start_event_adjust_interval',
261 'type' => CRM_Utils_Type
::T_INT
,
262 'title' => ts('Start Event Adjust Interval'),
263 'description' => ts('Status range begins this many units from start_event.'),
264 'where' => 'civicrm_membership_status.start_event_adjust_interval',
265 'table_name' => 'civicrm_membership_status',
266 'entity' => 'MembershipStatus',
267 'bao' => 'CRM_Member_BAO_MembershipStatus',
272 'name' => 'end_event',
273 'type' => CRM_Utils_Type
::T_STRING
,
274 'title' => ts('End Event'),
275 'description' => ts('Event after which this status ends.'),
277 'size' => CRM_Utils_Type
::TWELVE
,
278 'where' => 'civicrm_membership_status.end_event',
279 'table_name' => 'civicrm_membership_status',
280 'entity' => 'MembershipStatus',
281 'bao' => 'CRM_Member_BAO_MembershipStatus',
286 'pseudoconstant' => [
287 'callback' => 'CRM_Core_SelectValues::eventDate',
291 'end_event_adjust_unit' => [
292 'name' => 'end_event_adjust_unit',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('End Event Adjust Unit'),
295 'description' => ts('Unit used for adjusting from the ending event.'),
297 'size' => CRM_Utils_Type
::EIGHT
,
298 'where' => 'civicrm_membership_status.end_event_adjust_unit',
299 'table_name' => 'civicrm_membership_status',
300 'entity' => 'MembershipStatus',
301 'bao' => 'CRM_Member_BAO_MembershipStatus',
306 'pseudoconstant' => [
307 'callback' => 'CRM_Core_SelectValues::unitList',
311 'end_event_adjust_interval' => [
312 'name' => 'end_event_adjust_interval',
313 'type' => CRM_Utils_Type
::T_INT
,
314 'title' => ts('End Event Adjust Interval'),
315 'description' => ts('Status range ends this many units from end_event.'),
316 'where' => 'civicrm_membership_status.end_event_adjust_interval',
317 'table_name' => 'civicrm_membership_status',
318 'entity' => 'MembershipStatus',
319 'bao' => 'CRM_Member_BAO_MembershipStatus',
323 'is_current_member' => [
324 'name' => 'is_current_member',
325 'type' => CRM_Utils_Type
::T_BOOLEAN
,
326 'title' => ts('Current Membership?'),
327 '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).'),
328 'where' => 'civicrm_membership_status.is_current_member',
329 'table_name' => 'civicrm_membership_status',
330 'entity' => 'MembershipStatus',
331 'bao' => 'CRM_Member_BAO_MembershipStatus',
336 'name' => 'is_admin',
337 'type' => CRM_Utils_Type
::T_BOOLEAN
,
338 'title' => ts('Administrator Only?'),
339 'description' => ts('Is this status for admin/manual assignment only.'),
340 'where' => 'civicrm_membership_status.is_admin',
341 'table_name' => 'civicrm_membership_status',
342 'entity' => 'MembershipStatus',
343 'bao' => 'CRM_Member_BAO_MembershipStatus',
346 'type' => 'CheckBox',
352 'type' => CRM_Utils_Type
::T_INT
,
353 'title' => ts('Order'),
354 'where' => 'civicrm_membership_status.weight',
355 'table_name' => 'civicrm_membership_status',
356 'entity' => 'MembershipStatus',
357 'bao' => 'CRM_Member_BAO_MembershipStatus',
362 'name' => 'is_default',
363 'type' => CRM_Utils_Type
::T_BOOLEAN
,
364 'title' => ts('Default Status?'),
365 'description' => ts('Assign this status to a membership record if no other status match is found.'),
366 'where' => 'civicrm_membership_status.is_default',
367 'table_name' => 'civicrm_membership_status',
368 'entity' => 'MembershipStatus',
369 'bao' => 'CRM_Member_BAO_MembershipStatus',
372 'type' => 'CheckBox',
377 'name' => 'is_active',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Is Active'),
380 'description' => ts('Is this membership_status enabled.'),
381 'where' => 'civicrm_membership_status.is_active',
383 'table_name' => 'civicrm_membership_status',
384 'entity' => 'MembershipStatus',
385 'bao' => 'CRM_Member_BAO_MembershipStatus',
388 'type' => 'CheckBox',
393 'name' => 'is_reserved',
394 'type' => CRM_Utils_Type
::T_BOOLEAN
,
395 'title' => ts('Is Reserved'),
396 'description' => ts('Is this membership_status reserved.'),
397 'where' => 'civicrm_membership_status.is_reserved',
399 'table_name' => 'civicrm_membership_status',
400 'entity' => 'MembershipStatus',
401 'bao' => 'CRM_Member_BAO_MembershipStatus',
404 'type' => 'CheckBox',
409 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
411 return Civi
::$statics[__CLASS__
]['fields'];
415 * Return a mapping from field-name to the corresponding key (as used in fields()).
418 * Array(string $name => string $uniqueName).
420 public static function &fieldKeys() {
421 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
422 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
424 return Civi
::$statics[__CLASS__
]['fieldKeys'];
428 * Returns the names of this table
432 public static function getTableName() {
433 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
437 * Returns if this table needs to be logged
441 public function getLog() {
446 * Returns the list of fields that can be imported
448 * @param bool $prefix
452 public static function &import($prefix = FALSE) {
453 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_status', $prefix, []);
458 * Returns the list of fields that can be exported
460 * @param bool $prefix
464 public static function &export($prefix = FALSE) {
465 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_status', $prefix, []);
470 * Returns the list of indices
472 * @param bool $localize
476 public static function indices($localize = TRUE) {
478 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;