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:c1d4d2cd4959bd91c795c8458c3fd50e)
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',
187 'membership_status' => [
189 'type' => CRM_Utils_Type
::T_STRING
,
190 'title' => ts('Membership Status'),
191 'description' => ts('Name for Membership Status'),
193 'size' => CRM_Utils_Type
::HUGE
,
195 'where' => 'civicrm_membership_status.name',
197 'table_name' => 'civicrm_membership_status',
198 'entity' => 'MembershipStatus',
199 'bao' => 'CRM_Member_BAO_MembershipStatus',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Label'),
207 'description' => ts('Label for Membership Status'),
209 'size' => CRM_Utils_Type
::HUGE
,
210 'where' => 'civicrm_membership_status.label',
211 'table_name' => 'civicrm_membership_status',
212 'entity' => 'MembershipStatus',
213 'bao' => 'CRM_Member_BAO_MembershipStatus',
221 'name' => 'start_event',
222 'type' => CRM_Utils_Type
::T_STRING
,
223 'title' => ts('Start Event'),
224 'description' => ts('Event when this status starts.'),
226 'size' => CRM_Utils_Type
::TWELVE
,
227 'where' => 'civicrm_membership_status.start_event',
228 'table_name' => 'civicrm_membership_status',
229 'entity' => 'MembershipStatus',
230 'bao' => 'CRM_Member_BAO_MembershipStatus',
234 'label' => ts("Start Event"),
236 'pseudoconstant' => [
237 'callback' => 'CRM_Core_SelectValues::eventDate',
241 'start_event_adjust_unit' => [
242 'name' => 'start_event_adjust_unit',
243 'type' => CRM_Utils_Type
::T_STRING
,
244 'title' => ts('Start Event Adjust Unit'),
245 'description' => ts('Unit used for adjusting from start_event.'),
247 'size' => CRM_Utils_Type
::EIGHT
,
248 'where' => 'civicrm_membership_status.start_event_adjust_unit',
249 'table_name' => 'civicrm_membership_status',
250 'entity' => 'MembershipStatus',
251 'bao' => 'CRM_Member_BAO_MembershipStatus',
255 'label' => ts("Start Event Adjust Unit"),
257 'pseudoconstant' => [
258 'callback' => 'CRM_Core_SelectValues::unitList',
262 'start_event_adjust_interval' => [
263 'name' => 'start_event_adjust_interval',
264 'type' => CRM_Utils_Type
::T_INT
,
265 'title' => ts('Start Event Adjust Interval'),
266 'description' => ts('Status range begins this many units from start_event.'),
267 'where' => 'civicrm_membership_status.start_event_adjust_interval',
268 'table_name' => 'civicrm_membership_status',
269 'entity' => 'MembershipStatus',
270 'bao' => 'CRM_Member_BAO_MembershipStatus',
273 'label' => ts("Start Event Adjust Interval"),
278 'name' => 'end_event',
279 'type' => CRM_Utils_Type
::T_STRING
,
280 'title' => ts('End Event'),
281 'description' => ts('Event after which this status ends.'),
283 'size' => CRM_Utils_Type
::TWELVE
,
284 'where' => 'civicrm_membership_status.end_event',
285 'table_name' => 'civicrm_membership_status',
286 'entity' => 'MembershipStatus',
287 'bao' => 'CRM_Member_BAO_MembershipStatus',
291 'label' => ts("End Event"),
293 'pseudoconstant' => [
294 'callback' => 'CRM_Core_SelectValues::eventDate',
298 'end_event_adjust_unit' => [
299 'name' => 'end_event_adjust_unit',
300 'type' => CRM_Utils_Type
::T_STRING
,
301 'title' => ts('End Event Adjust Unit'),
302 'description' => ts('Unit used for adjusting from the ending event.'),
304 'size' => CRM_Utils_Type
::EIGHT
,
305 'where' => 'civicrm_membership_status.end_event_adjust_unit',
306 'table_name' => 'civicrm_membership_status',
307 'entity' => 'MembershipStatus',
308 'bao' => 'CRM_Member_BAO_MembershipStatus',
312 'label' => ts("End Event Adjust Unit"),
314 'pseudoconstant' => [
315 'callback' => 'CRM_Core_SelectValues::unitList',
319 'end_event_adjust_interval' => [
320 'name' => 'end_event_adjust_interval',
321 'type' => CRM_Utils_Type
::T_INT
,
322 'title' => ts('End Event Adjust Interval'),
323 'description' => ts('Status range ends this many units from end_event.'),
324 'where' => 'civicrm_membership_status.end_event_adjust_interval',
325 'table_name' => 'civicrm_membership_status',
326 'entity' => 'MembershipStatus',
327 'bao' => 'CRM_Member_BAO_MembershipStatus',
330 'label' => ts("End Event Adjust Interval"),
334 'is_current_member' => [
335 'name' => 'is_current_member',
336 'type' => CRM_Utils_Type
::T_BOOLEAN
,
337 'title' => ts('Current Membership?'),
338 '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).'),
339 'where' => 'civicrm_membership_status.is_current_member',
340 'table_name' => 'civicrm_membership_status',
341 'entity' => 'MembershipStatus',
342 'bao' => 'CRM_Member_BAO_MembershipStatus',
347 'name' => 'is_admin',
348 'type' => CRM_Utils_Type
::T_BOOLEAN
,
349 'title' => ts('Administrator Only?'),
350 'description' => ts('Is this status for admin/manual assignment only.'),
351 'where' => 'civicrm_membership_status.is_admin',
352 'table_name' => 'civicrm_membership_status',
353 'entity' => 'MembershipStatus',
354 'bao' => 'CRM_Member_BAO_MembershipStatus',
357 'type' => 'CheckBox',
363 'type' => CRM_Utils_Type
::T_INT
,
364 'title' => ts('Order'),
365 'where' => 'civicrm_membership_status.weight',
366 'table_name' => 'civicrm_membership_status',
367 'entity' => 'MembershipStatus',
368 'bao' => 'CRM_Member_BAO_MembershipStatus',
373 'name' => 'is_default',
374 'type' => CRM_Utils_Type
::T_BOOLEAN
,
375 'title' => ts('Default Status?'),
376 'description' => ts('Assign this status to a membership record if no other status match is found.'),
377 'where' => 'civicrm_membership_status.is_default',
378 'table_name' => 'civicrm_membership_status',
379 'entity' => 'MembershipStatus',
380 'bao' => 'CRM_Member_BAO_MembershipStatus',
383 'type' => 'CheckBox',
388 'name' => 'is_active',
389 'type' => CRM_Utils_Type
::T_BOOLEAN
,
390 'title' => ts('Is Active'),
391 'description' => ts('Is this membership_status enabled.'),
392 'where' => 'civicrm_membership_status.is_active',
394 'table_name' => 'civicrm_membership_status',
395 'entity' => 'MembershipStatus',
396 'bao' => 'CRM_Member_BAO_MembershipStatus',
399 'type' => 'CheckBox',
404 'name' => 'is_reserved',
405 'type' => CRM_Utils_Type
::T_BOOLEAN
,
406 'title' => ts('Is Reserved'),
407 'description' => ts('Is this membership_status reserved.'),
408 'where' => 'civicrm_membership_status.is_reserved',
410 'table_name' => 'civicrm_membership_status',
411 'entity' => 'MembershipStatus',
412 'bao' => 'CRM_Member_BAO_MembershipStatus',
415 'type' => 'CheckBox',
420 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
422 return Civi
::$statics[__CLASS__
]['fields'];
426 * Return a mapping from field-name to the corresponding key (as used in fields()).
429 * Array(string $name => string $uniqueName).
431 public static function &fieldKeys() {
432 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
433 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
435 return Civi
::$statics[__CLASS__
]['fieldKeys'];
439 * Returns the names of this table
443 public static function getTableName() {
444 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
448 * Returns if this table needs to be logged
452 public function getLog() {
457 * Returns the list of fields that can be imported
459 * @param bool $prefix
463 public static function &import($prefix = FALSE) {
464 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_status', $prefix, []);
469 * Returns the list of fields that can be exported
471 * @param bool $prefix
475 public static function &export($prefix = FALSE) {
476 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_status', $prefix, []);
481 * Returns the list of indices
483 * @param bool $localize
487 public static function indices($localize = TRUE) {
489 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;