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:e60a982e078b6f3b7d14b16ea2139f14)
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'),
194 'size' => CRM_Utils_Type
::HUGE
,
196 'where' => 'civicrm_membership_status.name',
198 'table_name' => 'civicrm_membership_status',
199 'entity' => 'MembershipStatus',
200 'bao' => 'CRM_Member_BAO_MembershipStatus',
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Label'),
208 'description' => ts('Label for Membership Status'),
210 'size' => CRM_Utils_Type
::HUGE
,
211 'where' => 'civicrm_membership_status.label',
212 'table_name' => 'civicrm_membership_status',
213 'entity' => 'MembershipStatus',
214 'bao' => 'CRM_Member_BAO_MembershipStatus',
222 'name' => 'start_event',
223 'type' => CRM_Utils_Type
::T_STRING
,
224 'title' => ts('Start Event'),
225 'description' => ts('Event when this status starts.'),
227 'size' => CRM_Utils_Type
::TWELVE
,
228 'where' => 'civicrm_membership_status.start_event',
229 'table_name' => 'civicrm_membership_status',
230 'entity' => 'MembershipStatus',
231 'bao' => 'CRM_Member_BAO_MembershipStatus',
235 'label' => ts("Start Event"),
237 'pseudoconstant' => [
238 'callback' => 'CRM_Core_SelectValues::eventDate',
242 'start_event_adjust_unit' => [
243 'name' => 'start_event_adjust_unit',
244 'type' => CRM_Utils_Type
::T_STRING
,
245 'title' => ts('Start Event Adjust Unit'),
246 'description' => ts('Unit used for adjusting from start_event.'),
248 'size' => CRM_Utils_Type
::EIGHT
,
249 'where' => 'civicrm_membership_status.start_event_adjust_unit',
250 'table_name' => 'civicrm_membership_status',
251 'entity' => 'MembershipStatus',
252 'bao' => 'CRM_Member_BAO_MembershipStatus',
256 'label' => ts("Start Event Adjust Unit"),
258 'pseudoconstant' => [
259 'callback' => 'CRM_Core_SelectValues::unitList',
263 'start_event_adjust_interval' => [
264 'name' => 'start_event_adjust_interval',
265 'type' => CRM_Utils_Type
::T_INT
,
266 'title' => ts('Start Event Adjust Interval'),
267 'description' => ts('Status range begins this many units from start_event.'),
268 'where' => 'civicrm_membership_status.start_event_adjust_interval',
269 'table_name' => 'civicrm_membership_status',
270 'entity' => 'MembershipStatus',
271 'bao' => 'CRM_Member_BAO_MembershipStatus',
274 'label' => ts("Start Event Adjust Interval"),
279 'name' => 'end_event',
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('End Event'),
282 'description' => ts('Event after which this status ends.'),
284 'size' => CRM_Utils_Type
::TWELVE
,
285 'where' => 'civicrm_membership_status.end_event',
286 'table_name' => 'civicrm_membership_status',
287 'entity' => 'MembershipStatus',
288 'bao' => 'CRM_Member_BAO_MembershipStatus',
292 'label' => ts("End Event"),
294 'pseudoconstant' => [
295 'callback' => 'CRM_Core_SelectValues::eventDate',
299 'end_event_adjust_unit' => [
300 'name' => 'end_event_adjust_unit',
301 'type' => CRM_Utils_Type
::T_STRING
,
302 'title' => ts('End Event Adjust Unit'),
303 'description' => ts('Unit used for adjusting from the ending event.'),
305 'size' => CRM_Utils_Type
::EIGHT
,
306 'where' => 'civicrm_membership_status.end_event_adjust_unit',
307 'table_name' => 'civicrm_membership_status',
308 'entity' => 'MembershipStatus',
309 'bao' => 'CRM_Member_BAO_MembershipStatus',
313 'label' => ts("End Event Adjust Unit"),
315 'pseudoconstant' => [
316 'callback' => 'CRM_Core_SelectValues::unitList',
320 'end_event_adjust_interval' => [
321 'name' => 'end_event_adjust_interval',
322 'type' => CRM_Utils_Type
::T_INT
,
323 'title' => ts('End Event Adjust Interval'),
324 'description' => ts('Status range ends this many units from end_event.'),
325 'where' => 'civicrm_membership_status.end_event_adjust_interval',
326 'table_name' => 'civicrm_membership_status',
327 'entity' => 'MembershipStatus',
328 'bao' => 'CRM_Member_BAO_MembershipStatus',
331 'label' => ts("End Event Adjust Interval"),
335 'is_current_member' => [
336 'name' => 'is_current_member',
337 'type' => CRM_Utils_Type
::T_BOOLEAN
,
338 'title' => ts('Current Membership?'),
339 '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).'),
340 'where' => 'civicrm_membership_status.is_current_member',
341 'table_name' => 'civicrm_membership_status',
342 'entity' => 'MembershipStatus',
343 'bao' => 'CRM_Member_BAO_MembershipStatus',
348 'name' => 'is_admin',
349 'type' => CRM_Utils_Type
::T_BOOLEAN
,
350 'title' => ts('Administrator Only?'),
351 'description' => ts('Is this status for admin/manual assignment only.'),
352 'where' => 'civicrm_membership_status.is_admin',
353 'table_name' => 'civicrm_membership_status',
354 'entity' => 'MembershipStatus',
355 'bao' => 'CRM_Member_BAO_MembershipStatus',
358 'type' => 'CheckBox',
364 'type' => CRM_Utils_Type
::T_INT
,
365 'title' => ts('Order'),
366 'where' => 'civicrm_membership_status.weight',
367 'table_name' => 'civicrm_membership_status',
368 'entity' => 'MembershipStatus',
369 'bao' => 'CRM_Member_BAO_MembershipStatus',
374 'name' => 'is_default',
375 'type' => CRM_Utils_Type
::T_BOOLEAN
,
376 'title' => ts('Default Status?'),
377 'description' => ts('Assign this status to a membership record if no other status match is found.'),
378 'where' => 'civicrm_membership_status.is_default',
379 'table_name' => 'civicrm_membership_status',
380 'entity' => 'MembershipStatus',
381 'bao' => 'CRM_Member_BAO_MembershipStatus',
384 'type' => 'CheckBox',
389 'name' => 'is_active',
390 'type' => CRM_Utils_Type
::T_BOOLEAN
,
391 'title' => ts('Is Active'),
392 'description' => ts('Is this membership_status enabled.'),
393 'where' => 'civicrm_membership_status.is_active',
395 'table_name' => 'civicrm_membership_status',
396 'entity' => 'MembershipStatus',
397 'bao' => 'CRM_Member_BAO_MembershipStatus',
400 'type' => 'CheckBox',
405 'name' => 'is_reserved',
406 'type' => CRM_Utils_Type
::T_BOOLEAN
,
407 'title' => ts('Is Reserved'),
408 'description' => ts('Is this membership_status reserved.'),
409 'where' => 'civicrm_membership_status.is_reserved',
411 'table_name' => 'civicrm_membership_status',
412 'entity' => 'MembershipStatus',
413 'bao' => 'CRM_Member_BAO_MembershipStatus',
416 'type' => 'CheckBox',
421 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
423 return Civi
::$statics[__CLASS__
]['fields'];
427 * Return a mapping from field-name to the corresponding key (as used in fields()).
430 * Array(string $name => string $uniqueName).
432 public static function &fieldKeys() {
433 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
434 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
436 return Civi
::$statics[__CLASS__
]['fieldKeys'];
440 * Returns the names of this table
444 public static function getTableName() {
445 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
449 * Returns if this table needs to be logged
453 public function getLog() {
458 * Returns the list of fields that can be imported
460 * @param bool $prefix
464 public static function &import($prefix = FALSE) {
465 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_status', $prefix, []);
470 * Returns the list of fields that can be exported
472 * @param bool $prefix
476 public static function &export($prefix = FALSE) {
477 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_status', $prefix, []);
482 * Returns the list of indices
484 * @param bool $localize
488 public static function indices($localize = TRUE) {
490 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;