3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Member/Membership.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:d92ffd88f95da56ec5e4463369c59155)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Member_DAO_Membership constructor.
40 class CRM_Member_DAO_Membership
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_membership';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
66 * FK to Membership Type
70 public $membership_type_id;
72 * Beginning of initial membership period (member since...).
78 * Beginning of current uninterrupted membership period.
84 * Current membership period expire date.
95 * FK to Membership Status
101 * Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.
107 * Optional FK to Parent Membership.
111 public $owner_membership_id;
113 * Maximum number of related memberships (membership_type override).
127 public $is_pay_later;
129 * Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.
133 public $contribution_recur_id;
135 * The campaign for which this membership is attached.
143 function __construct() {
144 $this->__table
= 'civicrm_membership';
145 parent
::__construct();
148 * Returns foreign keys and entity references.
151 * [CRM_Core_Reference_Interface]
153 static function getReferenceColumns() {
154 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
155 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
156 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
157 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
158 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'status_id', 'civicrm_membership_status', 'id');
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'owner_membership_id', 'civicrm_membership', 'id');
160 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id');
161 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
162 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
164 return Civi
::$statics[__CLASS__
]['links'];
167 * Returns all the column names of this table
171 static function &fields() {
172 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
173 Civi
::$statics[__CLASS__
]['fields'] = array(
174 'membership_id' => array(
176 'type' => CRM_Utils_Type
::T_INT
,
177 'title' => ts('Membership ID') ,
178 'description' => 'Membership Id',
181 'where' => 'civicrm_membership.id',
182 'headerPattern' => '/^(m(embership\s)?id)$/i',
185 'table_name' => 'civicrm_membership',
186 'entity' => 'Membership',
187 'bao' => 'CRM_Member_BAO_Membership',
189 'membership_contact_id' => array(
190 'name' => 'contact_id',
191 'type' => CRM_Utils_Type
::T_INT
,
192 'title' => ts('Contact ID') ,
193 'description' => 'FK to Contact ID',
196 'where' => 'civicrm_membership.contact_id',
197 'headerPattern' => '/contact(.?id)?/i',
198 'dataPattern' => '/^\d+$/',
200 'table_name' => 'civicrm_membership',
201 'entity' => 'Membership',
202 'bao' => 'CRM_Member_BAO_Membership',
203 'FKClassName' => 'CRM_Contact_DAO_Contact',
205 'type' => 'EntityRef',
208 'membership_type_id' => array(
209 'name' => 'membership_type_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Membership Type Id') ,
212 'description' => 'FK to Membership Type',
215 'where' => 'civicrm_membership.membership_type_id',
216 'headerPattern' => '/^(m(embership\s)?type)$/i',
219 'table_name' => 'civicrm_membership',
220 'entity' => 'Membership',
221 'bao' => 'CRM_Member_BAO_Membership',
222 'FKClassName' => 'CRM_Member_DAO_MembershipType',
226 'pseudoconstant' => array(
227 'table' => 'civicrm_membership_type',
229 'labelColumn' => 'name',
232 'join_date' => array(
233 'name' => 'join_date',
234 'type' => CRM_Utils_Type
::T_DATE
,
235 'title' => ts('Member Since') ,
236 'description' => 'Beginning of initial membership period (member since...).',
238 'where' => 'civicrm_membership.join_date',
239 'headerPattern' => '/^join|(j(oin\s)?date)$/i',
240 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
242 'table_name' => 'civicrm_membership',
243 'entity' => 'Membership',
244 'bao' => 'CRM_Member_BAO_Membership',
246 'type' => 'Select Date',
247 'formatType' => 'activityDate',
250 'membership_start_date' => array(
251 'name' => 'start_date',
252 'type' => CRM_Utils_Type
::T_DATE
,
253 'title' => ts('Membership Start Date') ,
254 'description' => 'Beginning of current uninterrupted membership period.',
256 'where' => 'civicrm_membership.start_date',
257 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i',
258 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
260 'table_name' => 'civicrm_membership',
261 'entity' => 'Membership',
262 'bao' => 'CRM_Member_BAO_Membership',
264 'type' => 'Select Date',
265 'formatType' => 'activityDate',
268 'membership_end_date' => array(
269 'name' => 'end_date',
270 'type' => CRM_Utils_Type
::T_DATE
,
271 'title' => ts('Membership Expiration Date') ,
272 'description' => 'Current membership period expire date.',
274 'where' => 'civicrm_membership.end_date',
275 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i',
276 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
278 'table_name' => 'civicrm_membership',
279 'entity' => 'Membership',
280 'bao' => 'CRM_Member_BAO_Membership',
282 'type' => 'Select Date',
283 'formatType' => 'activityDate',
286 'membership_source' => array(
288 'type' => CRM_Utils_Type
::T_STRING
,
289 'title' => ts('Source') ,
291 'size' => CRM_Utils_Type
::HUGE
,
293 'where' => 'civicrm_membership.source',
294 'headerPattern' => '/^(member(ship?))?source$/i',
297 'table_name' => 'civicrm_membership',
298 'entity' => 'Membership',
299 'bao' => 'CRM_Member_BAO_Membership',
304 'status_id' => array(
305 'name' => 'status_id',
306 'type' => CRM_Utils_Type
::T_INT
,
307 'title' => ts('Membership Status Id') ,
308 'description' => 'FK to Membership Status',
311 'where' => 'civicrm_membership.status_id',
312 'headerPattern' => '/(member(ship|).)?(status)$/i',
315 'table_name' => 'civicrm_membership',
316 'entity' => 'Membership',
317 'bao' => 'CRM_Member_BAO_Membership',
318 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
322 'pseudoconstant' => array(
323 'table' => 'civicrm_membership_status',
325 'labelColumn' => 'label',
328 'is_override' => array(
329 'name' => 'is_override',
330 'type' => CRM_Utils_Type
::T_BOOLEAN
,
331 'title' => ts('Status Override') ,
332 'description' => 'Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.',
334 'where' => 'civicrm_membership.is_override',
335 'headerPattern' => '/override$/i',
338 'table_name' => 'civicrm_membership',
339 'entity' => 'Membership',
340 'bao' => 'CRM_Member_BAO_Membership',
342 'type' => 'CheckBox',
345 'owner_membership_id' => array(
346 'name' => 'owner_membership_id',
347 'type' => CRM_Utils_Type
::T_INT
,
348 'title' => ts('Primary Member ID') ,
349 'description' => 'Optional FK to Parent Membership.',
351 'where' => 'civicrm_membership.owner_membership_id',
352 'headerPattern' => '',
354 'table_name' => 'civicrm_membership',
355 'entity' => 'Membership',
356 'bao' => 'CRM_Member_BAO_Membership',
357 'FKClassName' => 'CRM_Member_DAO_Membership',
359 'max_related' => array(
360 'name' => 'max_related',
361 'type' => CRM_Utils_Type
::T_INT
,
362 'title' => ts('Max Related') ,
363 'description' => 'Maximum number of related memberships (membership_type override).',
364 'table_name' => 'civicrm_membership',
365 'entity' => 'Membership',
366 'bao' => 'CRM_Member_BAO_Membership',
371 'member_is_test' => array(
373 'type' => CRM_Utils_Type
::T_BOOLEAN
,
374 'title' => ts('Test') ,
376 'where' => 'civicrm_membership.is_test',
377 'headerPattern' => '/(is.)?test(.member(ship)?)?/i',
380 'table_name' => 'civicrm_membership',
381 'entity' => 'Membership',
382 'bao' => 'CRM_Member_BAO_Membership',
384 'type' => 'CheckBox',
387 'member_is_pay_later' => array(
388 'name' => 'is_pay_later',
389 'type' => CRM_Utils_Type
::T_BOOLEAN
,
390 'title' => ts('Is Pay Later') ,
392 'where' => 'civicrm_membership.is_pay_later',
393 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
396 'table_name' => 'civicrm_membership',
397 'entity' => 'Membership',
398 'bao' => 'CRM_Member_BAO_Membership',
400 'type' => 'CheckBox',
403 'contribution_recur_id' => array(
404 'name' => 'contribution_recur_id',
405 'type' => CRM_Utils_Type
::T_INT
,
406 'title' => ts('Membership Recurring Contribution') ,
407 'description' => 'Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.',
408 'table_name' => 'civicrm_membership',
409 'entity' => 'Membership',
410 'bao' => 'CRM_Member_BAO_Membership',
411 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur',
413 'member_campaign_id' => array(
414 'name' => 'campaign_id',
415 'type' => CRM_Utils_Type
::T_INT
,
416 'title' => ts('Campaign') ,
417 'description' => 'The campaign for which this membership is attached.',
419 'where' => 'civicrm_membership.campaign_id',
420 'headerPattern' => '',
423 'table_name' => 'civicrm_membership',
424 'entity' => 'Membership',
425 'bao' => 'CRM_Member_BAO_Membership',
426 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
430 'pseudoconstant' => array(
431 'table' => 'civicrm_campaign',
433 'labelColumn' => 'title',
437 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
439 return Civi
::$statics[__CLASS__
]['fields'];
442 * Return a mapping from field-name to the corresponding key (as used in fields()).
445 * Array(string $name => string $uniqueName).
447 static function &fieldKeys() {
448 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
449 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
451 return Civi
::$statics[__CLASS__
]['fieldKeys'];
454 * Returns the names of this table
458 static function getTableName() {
459 return self
::$_tableName;
462 * Returns if this table needs to be logged
470 * Returns the list of fields that can be imported
472 * @param bool $prefix
476 static function &import($prefix = false) {
477 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership', $prefix, array());
481 * Returns the list of fields that can be exported
483 * @param bool $prefix
487 static function &export($prefix = false) {
488 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership', $prefix, array());