3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
31 * Generated from xml/schema/CRM/Member/Membership.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Member_DAO_Membership
extends CRM_Core_DAO
{
38 * static instance to hold the table name
42 static $_tableName = 'civicrm_membership';
44 * static instance to hold the field values
48 static $_fields = null;
50 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
60 static $_links = null;
62 * static instance to hold the values that can
67 static $_import = null;
69 * static instance to hold the values that can
74 static $_export = null;
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
95 * FK to Membership Type
99 public $membership_type_id;
101 * Beginning of initial membership period (member since...).
107 * Beginning of current uninterrupted membership period.
113 * Current membership period expire date.
124 * FK to Membership Status
130 * 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.
136 * Optional FK to Parent Membership.
140 public $owner_membership_id;
142 * Maximum number of related memberships (membership_type override).
156 public $is_pay_later;
158 * 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.
162 public $contribution_recur_id;
164 * The campaign for which this membership is attached.
172 * @return civicrm_membership
174 function __construct() {
175 $this->__table
= 'civicrm_membership';
176 parent
::__construct();
179 * Returns foreign keys and entity references
182 * [CRM_Core_Reference_Interface]
184 static function getReferenceColumns() {
185 if (!self
::$_links) {
186 self
::$_links = static ::createReferenceColumns(__CLASS__
);
187 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
188 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
189 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'status_id', 'civicrm_membership_status', 'id');
190 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'owner_membership_id', 'civicrm_membership', 'id');
191 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id');
192 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
194 return self
::$_links;
197 * Returns all the column names of this table
201 static function &fields() {
202 if (!(self
::$_fields)) {
203 self
::$_fields = array(
204 'membership_id' => array(
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Membership ID') ,
208 'description' => 'Membership Id',
211 'where' => 'civicrm_membership.id',
212 'headerPattern' => '/^(m(embership\s)?id)$/i',
216 'membership_contact_id' => array(
217 'name' => 'contact_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Contact ID') ,
220 'description' => 'FK to Contact ID',
223 'where' => 'civicrm_membership.contact_id',
224 'headerPattern' => '/contact(.?id)?/i',
225 'dataPattern' => '/^\d+$/',
227 'FKClassName' => 'CRM_Contact_DAO_Contact',
229 'type' => 'Autocomplete-Select',
232 'membership_type_id' => array(
233 'name' => 'membership_type_id',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Membership Type Id') ,
236 'description' => 'FK to Membership Type',
239 'where' => 'civicrm_membership.membership_type_id',
240 'headerPattern' => '/^(m(embership\s)?type)$/i',
243 'FKClassName' => 'CRM_Member_DAO_MembershipType',
247 'pseudoconstant' => array(
248 'table' => 'civicrm_membership_type',
250 'labelColumn' => 'name',
253 'join_date' => array(
254 'name' => 'join_date',
255 'type' => CRM_Utils_Type
::T_DATE
,
256 'title' => ts('Member Since') ,
257 'description' => 'Beginning of initial membership period (member since...).',
259 'where' => 'civicrm_membership.join_date',
260 'headerPattern' => '/^join|(j(oin\s)?date)$/i',
261 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
264 'type' => 'Select Date',
267 'membership_start_date' => array(
268 'name' => 'start_date',
269 'type' => CRM_Utils_Type
::T_DATE
,
270 'title' => ts('Membership Start Date') ,
271 'description' => 'Beginning of current uninterrupted membership period.',
273 'where' => 'civicrm_membership.start_date',
274 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i',
275 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
278 'type' => 'Select Date',
281 'membership_end_date' => array(
282 'name' => 'end_date',
283 'type' => CRM_Utils_Type
::T_DATE
,
284 'title' => ts('Membership Expiration Date') ,
285 'description' => 'Current membership period expire date.',
287 'where' => 'civicrm_membership.end_date',
288 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i',
289 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
292 'type' => 'Select Date',
295 'membership_source' => array(
297 'type' => CRM_Utils_Type
::T_STRING
,
298 'title' => ts('Source') ,
300 'size' => CRM_Utils_Type
::HUGE
,
302 'where' => 'civicrm_membership.source',
303 'headerPattern' => '/^(member(ship?))?source$/i',
310 'status_id' => array(
311 'name' => 'status_id',
312 'type' => CRM_Utils_Type
::T_INT
,
313 'title' => ts('Membership Status Id') ,
314 'description' => 'FK to Membership Status',
317 'where' => 'civicrm_membership.status_id',
318 'headerPattern' => '/(member(ship|).)?(status)$/i',
321 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
325 'pseudoconstant' => array(
326 'table' => 'civicrm_membership_status',
328 'labelColumn' => 'label',
331 'is_override' => array(
332 'name' => 'is_override',
333 'type' => CRM_Utils_Type
::T_BOOLEAN
,
334 'title' => ts('Status Override') ,
335 '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.',
337 'where' => 'civicrm_membership.is_override',
338 'headerPattern' => '/override$/i',
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 'FKClassName' => 'CRM_Member_DAO_Membership',
356 'max_related' => array(
357 'name' => 'max_related',
358 'type' => CRM_Utils_Type
::T_INT
,
359 'title' => ts('Max Related') ,
360 'description' => 'Maximum number of related memberships (membership_type override).',
365 'member_is_test' => array(
367 'type' => CRM_Utils_Type
::T_BOOLEAN
,
368 'title' => ts('Test') ,
370 'where' => 'civicrm_membership.is_test',
371 'headerPattern' => '/(is.)?test(.member(ship)?)?/i',
375 'type' => 'CheckBox',
378 'member_is_pay_later' => array(
379 'name' => 'is_pay_later',
380 'type' => CRM_Utils_Type
::T_BOOLEAN
,
381 'title' => ts('Is Pay Later') ,
383 'where' => 'civicrm_membership.is_pay_later',
384 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
388 'type' => 'CheckBox',
391 'contribution_recur_id' => array(
392 'name' => 'contribution_recur_id',
393 'type' => CRM_Utils_Type
::T_INT
,
394 'title' => ts('Memberhip Recurring Contribution') ,
395 '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.',
396 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur',
398 'member_campaign_id' => array(
399 'name' => 'campaign_id',
400 'type' => CRM_Utils_Type
::T_INT
,
401 'title' => ts('Campaign') ,
402 'description' => 'The campaign for which this membership is attached.',
404 'where' => 'civicrm_membership.campaign_id',
405 'headerPattern' => '',
408 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
412 'pseudoconstant' => array(
413 'table' => 'civicrm_campaign',
415 'labelColumn' => 'title',
420 return self
::$_fields;
423 * Returns an array containing, for each field, the arary key used for that
424 * field in self::$_fields.
428 static function &fieldKeys() {
429 if (!(self
::$_fieldKeys)) {
430 self
::$_fieldKeys = array(
431 'id' => 'membership_id',
432 'contact_id' => 'membership_contact_id',
433 'membership_type_id' => 'membership_type_id',
434 'join_date' => 'join_date',
435 'start_date' => 'membership_start_date',
436 'end_date' => 'membership_end_date',
437 'source' => 'membership_source',
438 'status_id' => 'status_id',
439 'is_override' => 'is_override',
440 'owner_membership_id' => 'owner_membership_id',
441 'max_related' => 'max_related',
442 'is_test' => 'member_is_test',
443 'is_pay_later' => 'member_is_pay_later',
444 'contribution_recur_id' => 'contribution_recur_id',
445 'campaign_id' => 'member_campaign_id',
448 return self
::$_fieldKeys;
451 * Returns the names of this table
455 static function getTableName() {
456 return self
::$_tableName;
459 * Returns if this table needs to be logged
467 * Returns the list of fields that can be imported
469 * @param bool $prefix
473 static function &import($prefix = false) {
474 if (!(self
::$_import)) {
475 self
::$_import = array();
476 $fields = self
::fields();
477 foreach($fields as $name => $field) {
478 if (CRM_Utils_Array
::value('import', $field)) {
480 self
::$_import['membership'] = & $fields[$name];
482 self
::$_import[$name] = & $fields[$name];
487 return self
::$_import;
490 * Returns the list of fields that can be exported
492 * @param bool $prefix
496 static function &export($prefix = false) {
497 if (!(self
::$_export)) {
498 self
::$_export = array();
499 $fields = self
::fields();
500 foreach($fields as $name => $field) {
501 if (CRM_Utils_Array
::value('export', $field)) {
503 self
::$_export['membership'] = & $fields[$name];
505 self
::$_export[$name] = & $fields[$name];
510 return self
::$_export;