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:af39fa64c6d191dcc6c1fc2c627b38fd)
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',
233 'label' => ts("Start Event"),
235 'pseudoconstant' => [
236 'callback' => 'CRM_Core_SelectValues::eventDate',
240 'start_event_adjust_unit' => [
241 'name' => 'start_event_adjust_unit',
242 'type' => CRM_Utils_Type
::T_STRING
,
243 'title' => ts('Start Event Adjust Unit'),
244 'description' => ts('Unit used for adjusting from start_event.'),
246 'size' => CRM_Utils_Type
::EIGHT
,
247 'where' => 'civicrm_membership_status.start_event_adjust_unit',
248 'table_name' => 'civicrm_membership_status',
249 'entity' => 'MembershipStatus',
250 'bao' => 'CRM_Member_BAO_MembershipStatus',
254 'label' => ts("Start Event Adjust Unit"),
256 'pseudoconstant' => [
257 'callback' => 'CRM_Core_SelectValues::unitList',
261 'start_event_adjust_interval' => [
262 'name' => 'start_event_adjust_interval',
263 'type' => CRM_Utils_Type
::T_INT
,
264 'title' => ts('Start Event Adjust Interval'),
265 'description' => ts('Status range begins this many units from start_event.'),
266 'where' => 'civicrm_membership_status.start_event_adjust_interval',
267 'table_name' => 'civicrm_membership_status',
268 'entity' => 'MembershipStatus',
269 'bao' => 'CRM_Member_BAO_MembershipStatus',
272 'label' => ts("Start Event Adjust Interval"),
277 'name' => 'end_event',
278 'type' => CRM_Utils_Type
::T_STRING
,
279 'title' => ts('End Event'),
280 'description' => ts('Event after which this status ends.'),
282 'size' => CRM_Utils_Type
::TWELVE
,
283 'where' => 'civicrm_membership_status.end_event',
284 'table_name' => 'civicrm_membership_status',
285 'entity' => 'MembershipStatus',
286 'bao' => 'CRM_Member_BAO_MembershipStatus',
290 'label' => ts("End Event"),
292 'pseudoconstant' => [
293 'callback' => 'CRM_Core_SelectValues::eventDate',
297 'end_event_adjust_unit' => [
298 'name' => 'end_event_adjust_unit',
299 'type' => CRM_Utils_Type
::T_STRING
,
300 'title' => ts('End Event Adjust Unit'),
301 'description' => ts('Unit used for adjusting from the ending event.'),
303 'size' => CRM_Utils_Type
::EIGHT
,
304 'where' => 'civicrm_membership_status.end_event_adjust_unit',
305 'table_name' => 'civicrm_membership_status',
306 'entity' => 'MembershipStatus',
307 'bao' => 'CRM_Member_BAO_MembershipStatus',
311 'label' => ts("End Event Adjust Unit"),
313 'pseudoconstant' => [
314 'callback' => 'CRM_Core_SelectValues::unitList',
318 'end_event_adjust_interval' => [
319 'name' => 'end_event_adjust_interval',
320 'type' => CRM_Utils_Type
::T_INT
,
321 'title' => ts('End Event Adjust Interval'),
322 'description' => ts('Status range ends this many units from end_event.'),
323 'where' => 'civicrm_membership_status.end_event_adjust_interval',
324 'table_name' => 'civicrm_membership_status',
325 'entity' => 'MembershipStatus',
326 'bao' => 'CRM_Member_BAO_MembershipStatus',
329 'label' => ts("End Event Adjust Interval"),
333 'is_current_member' => [
334 'name' => 'is_current_member',
335 'type' => CRM_Utils_Type
::T_BOOLEAN
,
336 'title' => ts('Current Membership?'),
337 '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).'),
338 'where' => 'civicrm_membership_status.is_current_member',
339 'table_name' => 'civicrm_membership_status',
340 'entity' => 'MembershipStatus',
341 'bao' => 'CRM_Member_BAO_MembershipStatus',
346 'name' => 'is_admin',
347 'type' => CRM_Utils_Type
::T_BOOLEAN
,
348 'title' => ts('Administrator Only?'),
349 'description' => ts('Is this status for admin/manual assignment only.'),
350 'where' => 'civicrm_membership_status.is_admin',
351 'table_name' => 'civicrm_membership_status',
352 'entity' => 'MembershipStatus',
353 'bao' => 'CRM_Member_BAO_MembershipStatus',
356 'type' => 'CheckBox',
362 'type' => CRM_Utils_Type
::T_INT
,
363 'title' => ts('Order'),
364 'where' => 'civicrm_membership_status.weight',
365 'table_name' => 'civicrm_membership_status',
366 'entity' => 'MembershipStatus',
367 'bao' => 'CRM_Member_BAO_MembershipStatus',
372 'name' => 'is_default',
373 'type' => CRM_Utils_Type
::T_BOOLEAN
,
374 'title' => ts('Default Status?'),
375 'description' => ts('Assign this status to a membership record if no other status match is found.'),
376 'where' => 'civicrm_membership_status.is_default',
377 'table_name' => 'civicrm_membership_status',
378 'entity' => 'MembershipStatus',
379 'bao' => 'CRM_Member_BAO_MembershipStatus',
382 'type' => 'CheckBox',
387 'name' => 'is_active',
388 'type' => CRM_Utils_Type
::T_BOOLEAN
,
389 'title' => ts('Is Active'),
390 'description' => ts('Is this membership_status enabled.'),
391 'where' => 'civicrm_membership_status.is_active',
393 'table_name' => 'civicrm_membership_status',
394 'entity' => 'MembershipStatus',
395 'bao' => 'CRM_Member_BAO_MembershipStatus',
398 'type' => 'CheckBox',
403 'name' => 'is_reserved',
404 'type' => CRM_Utils_Type
::T_BOOLEAN
,
405 'title' => ts('Is Reserved'),
406 'description' => ts('Is this membership_status reserved.'),
407 'where' => 'civicrm_membership_status.is_reserved',
409 'table_name' => 'civicrm_membership_status',
410 'entity' => 'MembershipStatus',
411 'bao' => 'CRM_Member_BAO_MembershipStatus',
414 'type' => 'CheckBox',
419 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
421 return Civi
::$statics[__CLASS__
]['fields'];
425 * Return a mapping from field-name to the corresponding key (as used in fields()).
428 * Array(string $name => string $uniqueName).
430 public static function &fieldKeys() {
431 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
432 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
434 return Civi
::$statics[__CLASS__
]['fieldKeys'];
438 * Returns the names of this table
442 public static function getTableName() {
443 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
447 * Returns if this table needs to be logged
451 public function getLog() {
456 * Returns the list of fields that can be imported
458 * @param bool $prefix
462 public static function &import($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_status', $prefix, []);
468 * Returns the list of fields that can be exported
470 * @param bool $prefix
474 public static function &export($prefix = FALSE) {
475 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_status', $prefix, []);
480 * Returns the list of indices
482 * @param bool $localize
486 public static function indices($localize = TRUE) {
488 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;