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:c9823a62881681e2126d92c19e85876f)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Member_DAO_Membership
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_membership';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
64 * FK to Membership Type
68 public $membership_type_id;
70 * Beginning of initial membership period (member since...).
76 * Beginning of current uninterrupted membership period.
82 * Current membership period expire date.
93 * FK to Membership Status
99 * 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.
105 * Optional FK to Parent Membership.
109 public $owner_membership_id;
111 * Maximum number of related memberships (membership_type override).
125 public $is_pay_later;
127 * 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.
131 public $contribution_recur_id;
133 * The campaign for which this membership is attached.
141 * @return civicrm_membership
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',
186 'membership_contact_id' => array(
187 'name' => 'contact_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Contact ID') ,
190 'description' => 'FK to Contact ID',
193 'where' => 'civicrm_membership.contact_id',
194 'headerPattern' => '/contact(.?id)?/i',
195 'dataPattern' => '/^\d+$/',
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
199 'type' => 'EntityRef',
202 'membership_type_id' => array(
203 'name' => 'membership_type_id',
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Membership Type Id') ,
206 'description' => 'FK to Membership Type',
209 'where' => 'civicrm_membership.membership_type_id',
210 'headerPattern' => '/^(m(embership\s)?type)$/i',
213 'FKClassName' => 'CRM_Member_DAO_MembershipType',
217 'pseudoconstant' => array(
218 'table' => 'civicrm_membership_type',
220 'labelColumn' => 'name',
223 'join_date' => array(
224 'name' => 'join_date',
225 'type' => CRM_Utils_Type
::T_DATE
,
226 'title' => ts('Member Since') ,
227 'description' => 'Beginning of initial membership period (member since...).',
229 'where' => 'civicrm_membership.join_date',
230 'headerPattern' => '/^join|(j(oin\s)?date)$/i',
231 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
234 'type' => 'Select Date',
237 'membership_start_date' => array(
238 'name' => 'start_date',
239 'type' => CRM_Utils_Type
::T_DATE
,
240 'title' => ts('Membership Start Date') ,
241 'description' => 'Beginning of current uninterrupted membership period.',
243 'where' => 'civicrm_membership.start_date',
244 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i',
245 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
248 'type' => 'Select Date',
251 'membership_end_date' => array(
252 'name' => 'end_date',
253 'type' => CRM_Utils_Type
::T_DATE
,
254 'title' => ts('Membership Expiration Date') ,
255 'description' => 'Current membership period expire date.',
257 'where' => 'civicrm_membership.end_date',
258 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i',
259 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
262 'type' => 'Select Date',
265 'membership_source' => array(
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Source') ,
270 'size' => CRM_Utils_Type
::HUGE
,
272 'where' => 'civicrm_membership.source',
273 'headerPattern' => '/^(member(ship?))?source$/i',
280 'status_id' => array(
281 'name' => 'status_id',
282 'type' => CRM_Utils_Type
::T_INT
,
283 'title' => ts('Membership Status Id') ,
284 'description' => 'FK to Membership Status',
287 'where' => 'civicrm_membership.status_id',
288 'headerPattern' => '/(member(ship|).)?(status)$/i',
291 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
295 'pseudoconstant' => array(
296 'table' => 'civicrm_membership_status',
298 'labelColumn' => 'label',
301 'is_override' => array(
302 'name' => 'is_override',
303 'type' => CRM_Utils_Type
::T_BOOLEAN
,
304 'title' => ts('Status Override') ,
305 '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.',
307 'where' => 'civicrm_membership.is_override',
308 'headerPattern' => '/override$/i',
312 'type' => 'CheckBox',
315 'owner_membership_id' => array(
316 'name' => 'owner_membership_id',
317 'type' => CRM_Utils_Type
::T_INT
,
318 'title' => ts('Primary Member ID') ,
319 'description' => 'Optional FK to Parent Membership.',
321 'where' => 'civicrm_membership.owner_membership_id',
322 'headerPattern' => '',
324 'FKClassName' => 'CRM_Member_DAO_Membership',
326 'max_related' => array(
327 'name' => 'max_related',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Max Related') ,
330 'description' => 'Maximum number of related memberships (membership_type override).',
335 'member_is_test' => array(
337 'type' => CRM_Utils_Type
::T_BOOLEAN
,
338 'title' => ts('Test') ,
340 'where' => 'civicrm_membership.is_test',
341 'headerPattern' => '/(is.)?test(.member(ship)?)?/i',
345 'type' => 'CheckBox',
348 'member_is_pay_later' => array(
349 'name' => 'is_pay_later',
350 'type' => CRM_Utils_Type
::T_BOOLEAN
,
351 'title' => ts('Is Pay Later') ,
353 'where' => 'civicrm_membership.is_pay_later',
354 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
358 'type' => 'CheckBox',
361 'contribution_recur_id' => array(
362 'name' => 'contribution_recur_id',
363 'type' => CRM_Utils_Type
::T_INT
,
364 'title' => ts('Membership Recurring Contribution') ,
365 '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.',
366 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur',
368 'member_campaign_id' => array(
369 'name' => 'campaign_id',
370 'type' => CRM_Utils_Type
::T_INT
,
371 'title' => ts('Campaign') ,
372 'description' => 'The campaign for which this membership is attached.',
374 'where' => 'civicrm_membership.campaign_id',
375 'headerPattern' => '',
378 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
382 'pseudoconstant' => array(
383 'table' => 'civicrm_campaign',
385 'labelColumn' => 'title',
389 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
391 return Civi
::$statics[__CLASS__
]['fields'];
394 * Return a mapping from field-name to the corresponding key (as used in fields()).
397 * Array(string $name => string $uniqueName).
399 static function &fieldKeys() {
400 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
401 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
403 return Civi
::$statics[__CLASS__
]['fieldKeys'];
406 * Returns the names of this table
410 static function getTableName() {
411 return self
::$_tableName;
414 * Returns if this table needs to be logged
422 * Returns the list of fields that can be imported
424 * @param bool $prefix
428 static function &import($prefix = false) {
429 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership', $prefix, array());
433 * Returns the list of fields that can be exported
435 * @param bool $prefix
439 static function &export($prefix = false) {
440 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership', $prefix, array());