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:32d46c01e3eb4143e83820310037df39)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * Name for Membership Status
49 * Label for Membership Status
56 * Event when this status starts.
63 * Unit used for adjusting from start_event.
67 public $start_event_adjust_unit;
70 * Status range begins this many units from start_event.
74 public $start_event_adjust_interval;
77 * Event after which this status ends.
84 * Unit used for adjusting from the ending event.
88 public $end_event_adjust_unit;
91 * Status range ends this many units from end_event.
95 public $end_event_adjust_interval;
98 * Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).
102 public $is_current_member;
105 * Is this status for admin/manual assignment only.
117 * Assign this status to a membership record if no other status match is found.
124 * Is this membership_status enabled.
131 * Is this membership_status reserved.
140 public function __construct() {
141 $this->__table
= 'civicrm_membership_status';
142 parent
::__construct();
146 * Returns localized title of this entity.
148 * @param bool $plural
149 * Whether to return the plural version of the title.
151 public static function getEntityTitle($plural = FALSE) {
152 return $plural ?
ts('Membership Statuses') : ts('Membership Status');
156 * Returns all the column names of this table
160 public static function &fields() {
161 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
162 Civi
::$statics[__CLASS__
]['fields'] = [
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('Membership Status ID'),
167 'description' => ts('Membership Id'),
169 'where' => 'civicrm_membership_status.id',
170 'table_name' => 'civicrm_membership_status',
171 'entity' => 'MembershipStatus',
172 'bao' => 'CRM_Member_BAO_MembershipStatus',
176 'membership_status' => [
178 'type' => CRM_Utils_Type
::T_STRING
,
179 'title' => ts('Membership Status'),
180 'description' => ts('Name for Membership Status'),
182 'size' => CRM_Utils_Type
::HUGE
,
184 'where' => 'civicrm_membership_status.name',
186 'table_name' => 'civicrm_membership_status',
187 'entity' => 'MembershipStatus',
188 'bao' => 'CRM_Member_BAO_MembershipStatus',
194 'type' => CRM_Utils_Type
::T_STRING
,
195 'title' => ts('Label'),
196 'description' => ts('Label for Membership Status'),
198 'size' => CRM_Utils_Type
::HUGE
,
199 'where' => 'civicrm_membership_status.label',
200 'table_name' => 'civicrm_membership_status',
201 'entity' => 'MembershipStatus',
202 'bao' => 'CRM_Member_BAO_MembershipStatus',
210 'name' => 'start_event',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Start Event'),
213 'description' => ts('Event when this status starts.'),
215 'size' => CRM_Utils_Type
::TWELVE
,
216 'where' => 'civicrm_membership_status.start_event',
217 'table_name' => 'civicrm_membership_status',
218 'entity' => 'MembershipStatus',
219 'bao' => 'CRM_Member_BAO_MembershipStatus',
224 'pseudoconstant' => [
225 'callback' => 'CRM_Core_SelectValues::eventDate',
229 'start_event_adjust_unit' => [
230 'name' => 'start_event_adjust_unit',
231 'type' => CRM_Utils_Type
::T_STRING
,
232 'title' => ts('Start Event Adjust Unit'),
233 'description' => ts('Unit used for adjusting from start_event.'),
235 'size' => CRM_Utils_Type
::EIGHT
,
236 'where' => 'civicrm_membership_status.start_event_adjust_unit',
237 'table_name' => 'civicrm_membership_status',
238 'entity' => 'MembershipStatus',
239 'bao' => 'CRM_Member_BAO_MembershipStatus',
244 'pseudoconstant' => [
245 'callback' => 'CRM_Core_SelectValues::unitList',
249 'start_event_adjust_interval' => [
250 'name' => 'start_event_adjust_interval',
251 'type' => CRM_Utils_Type
::T_INT
,
252 'title' => ts('Start Event Adjust Interval'),
253 'description' => ts('Status range begins this many units from start_event.'),
254 'where' => 'civicrm_membership_status.start_event_adjust_interval',
255 'table_name' => 'civicrm_membership_status',
256 'entity' => 'MembershipStatus',
257 'bao' => 'CRM_Member_BAO_MembershipStatus',
262 'name' => 'end_event',
263 'type' => CRM_Utils_Type
::T_STRING
,
264 'title' => ts('End Event'),
265 'description' => ts('Event after which this status ends.'),
267 'size' => CRM_Utils_Type
::TWELVE
,
268 'where' => 'civicrm_membership_status.end_event',
269 'table_name' => 'civicrm_membership_status',
270 'entity' => 'MembershipStatus',
271 'bao' => 'CRM_Member_BAO_MembershipStatus',
276 'pseudoconstant' => [
277 'callback' => 'CRM_Core_SelectValues::eventDate',
281 'end_event_adjust_unit' => [
282 'name' => 'end_event_adjust_unit',
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('End Event Adjust Unit'),
285 'description' => ts('Unit used for adjusting from the ending event.'),
287 'size' => CRM_Utils_Type
::EIGHT
,
288 'where' => 'civicrm_membership_status.end_event_adjust_unit',
289 'table_name' => 'civicrm_membership_status',
290 'entity' => 'MembershipStatus',
291 'bao' => 'CRM_Member_BAO_MembershipStatus',
296 'pseudoconstant' => [
297 'callback' => 'CRM_Core_SelectValues::unitList',
301 'end_event_adjust_interval' => [
302 'name' => 'end_event_adjust_interval',
303 'type' => CRM_Utils_Type
::T_INT
,
304 'title' => ts('End Event Adjust Interval'),
305 'description' => ts('Status range ends this many units from end_event.'),
306 'where' => 'civicrm_membership_status.end_event_adjust_interval',
307 'table_name' => 'civicrm_membership_status',
308 'entity' => 'MembershipStatus',
309 'bao' => 'CRM_Member_BAO_MembershipStatus',
313 'is_current_member' => [
314 'name' => 'is_current_member',
315 'type' => CRM_Utils_Type
::T_BOOLEAN
,
316 'title' => ts('Current Membership?'),
317 '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).'),
318 'where' => 'civicrm_membership_status.is_current_member',
319 'table_name' => 'civicrm_membership_status',
320 'entity' => 'MembershipStatus',
321 'bao' => 'CRM_Member_BAO_MembershipStatus',
326 'name' => 'is_admin',
327 'type' => CRM_Utils_Type
::T_BOOLEAN
,
328 'title' => ts('Administrator Only?'),
329 'description' => ts('Is this status for admin/manual assignment only.'),
330 'where' => 'civicrm_membership_status.is_admin',
331 'table_name' => 'civicrm_membership_status',
332 'entity' => 'MembershipStatus',
333 'bao' => 'CRM_Member_BAO_MembershipStatus',
336 'type' => 'CheckBox',
342 'type' => CRM_Utils_Type
::T_INT
,
343 'title' => ts('Order'),
344 'where' => 'civicrm_membership_status.weight',
345 'table_name' => 'civicrm_membership_status',
346 'entity' => 'MembershipStatus',
347 'bao' => 'CRM_Member_BAO_MembershipStatus',
352 'name' => 'is_default',
353 'type' => CRM_Utils_Type
::T_BOOLEAN
,
354 'title' => ts('Default Status?'),
355 'description' => ts('Assign this status to a membership record if no other status match is found.'),
356 'where' => 'civicrm_membership_status.is_default',
357 'table_name' => 'civicrm_membership_status',
358 'entity' => 'MembershipStatus',
359 'bao' => 'CRM_Member_BAO_MembershipStatus',
362 'type' => 'CheckBox',
367 'name' => 'is_active',
368 'type' => CRM_Utils_Type
::T_BOOLEAN
,
369 'title' => ts('Is Active'),
370 'description' => ts('Is this membership_status enabled.'),
371 'where' => 'civicrm_membership_status.is_active',
373 'table_name' => 'civicrm_membership_status',
374 'entity' => 'MembershipStatus',
375 'bao' => 'CRM_Member_BAO_MembershipStatus',
378 'type' => 'CheckBox',
383 'name' => 'is_reserved',
384 'type' => CRM_Utils_Type
::T_BOOLEAN
,
385 'title' => ts('Is Reserved'),
386 'description' => ts('Is this membership_status reserved.'),
387 'where' => 'civicrm_membership_status.is_reserved',
389 'table_name' => 'civicrm_membership_status',
390 'entity' => 'MembershipStatus',
391 'bao' => 'CRM_Member_BAO_MembershipStatus',
394 'type' => 'CheckBox',
399 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
401 return Civi
::$statics[__CLASS__
]['fields'];
405 * Return a mapping from field-name to the corresponding key (as used in fields()).
408 * Array(string $name => string $uniqueName).
410 public static function &fieldKeys() {
411 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
412 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
414 return Civi
::$statics[__CLASS__
]['fieldKeys'];
418 * Returns the names of this table
422 public static function getTableName() {
423 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
427 * Returns if this table needs to be logged
431 public function getLog() {
436 * Returns the list of fields that can be imported
438 * @param bool $prefix
442 public static function &import($prefix = FALSE) {
443 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_status', $prefix, []);
448 * Returns the list of fields that can be exported
450 * @param bool $prefix
454 public static function &export($prefix = FALSE) {
455 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_status', $prefix, []);
460 * Returns the list of indices
462 * @param bool $localize
466 public static function indices($localize = TRUE) {
468 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;