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/MembershipType.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:22af2c3f87df3ad7cf2002c145f53cc6)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Member_DAO_MembershipType constructor.
40 class CRM_Member_DAO_MembershipType
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_membership_type';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * Which Domain is this match entry for
66 * Name of Membership Type
72 * Description of Membership Type
78 * Owner organization for this membership type. FK to Contact ID
82 public $member_of_contact_id;
84 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
88 public $financial_type_id;
90 * Minimum fee for this membership (0 for free/complimentary memberships).
96 * Unit in which membership period is expressed.
100 public $duration_unit;
102 * Number of duration units in membership period (e.g. 1 year, 12 months).
106 public $duration_interval;
108 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
114 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
118 public $fixed_period_start_day;
120 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
124 public $fixed_period_rollover_day;
126 * FK to Relationship Type ID
130 public $relationship_type_id;
135 public $relationship_direction;
137 * Maximum number of related memberships.
153 * Receipt Text for membership signup
157 public $receipt_text_signup;
159 * Receipt Text for membership renewal
163 public $receipt_text_renewal;
165 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
171 * Is this membership_type enabled
179 function __construct() {
180 $this->__table
= 'civicrm_membership_type';
181 parent
::__construct();
184 * Returns foreign keys and entity references.
187 * [CRM_Core_Reference_Interface]
189 static function getReferenceColumns() {
190 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
191 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
192 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'domain_id', 'civicrm_domain', 'id');
193 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'member_of_contact_id', 'civicrm_contact', 'id');
194 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
195 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
197 return Civi
::$statics[__CLASS__
]['links'];
200 * Returns all the column names of this table
204 static function &fields() {
205 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
206 Civi
::$statics[__CLASS__
]['fields'] = array(
209 'type' => CRM_Utils_Type
::T_INT
,
210 'title' => ts('Membership Type ID') ,
211 'description' => 'Membership Id',
213 'table_name' => 'civicrm_membership_type',
214 'entity' => 'MembershipType',
215 'bao' => 'CRM_Member_BAO_MembershipType',
218 'domain_id' => array(
219 'name' => 'domain_id',
220 'type' => CRM_Utils_Type
::T_INT
,
221 'title' => ts('Membership Type Domain') ,
222 'description' => 'Which Domain is this match entry for',
224 'table_name' => 'civicrm_membership_type',
225 'entity' => 'MembershipType',
226 'bao' => 'CRM_Member_BAO_MembershipType',
228 'FKClassName' => 'CRM_Core_DAO_Domain',
229 'pseudoconstant' => array(
230 'table' => 'civicrm_domain',
232 'labelColumn' => 'name',
235 'membership_type' => array(
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('Membership Type') ,
239 'description' => 'Name of Membership Type',
241 'size' => CRM_Utils_Type
::HUGE
,
243 'where' => 'civicrm_membership_type.name',
244 'headerPattern' => '',
247 'table_name' => 'civicrm_membership_type',
248 'entity' => 'MembershipType',
249 'bao' => 'CRM_Member_BAO_MembershipType',
252 'description' => array(
253 'name' => 'description',
254 'type' => CRM_Utils_Type
::T_STRING
,
255 'title' => ts('Membership Type Description') ,
256 'description' => 'Description of Membership Type',
258 'size' => CRM_Utils_Type
::HUGE
,
259 'table_name' => 'civicrm_membership_type',
260 'entity' => 'MembershipType',
261 'bao' => 'CRM_Member_BAO_MembershipType',
264 'type' => 'TextArea',
267 'member_of_contact_id' => array(
268 'name' => 'member_of_contact_id',
269 'type' => CRM_Utils_Type
::T_INT
,
270 'title' => ts('Membership Type Organization') ,
271 'description' => 'Owner organization for this membership type. FK to Contact ID',
273 'table_name' => 'civicrm_membership_type',
274 'entity' => 'MembershipType',
275 'bao' => 'CRM_Member_BAO_MembershipType',
277 'FKClassName' => 'CRM_Contact_DAO_Contact',
279 'financial_type_id' => array(
280 'name' => 'financial_type_id',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Membership Financial Type') ,
283 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id',
285 'table_name' => 'civicrm_membership_type',
286 'entity' => 'MembershipType',
287 'bao' => 'CRM_Member_BAO_MembershipType',
289 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
290 'pseudoconstant' => array(
291 'table' => 'civicrm_financial_type',
293 'labelColumn' => 'name',
296 'minimum_fee' => array(
297 'name' => 'minimum_fee',
298 'type' => CRM_Utils_Type
::T_MONEY
,
299 'title' => ts('membership Type Minimum Fee') ,
300 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).',
301 'precision' => array(
305 'table_name' => 'civicrm_membership_type',
306 'entity' => 'MembershipType',
307 'bao' => 'CRM_Member_BAO_MembershipType',
310 'duration_unit' => array(
311 'name' => 'duration_unit',
312 'type' => CRM_Utils_Type
::T_STRING
,
313 'title' => ts('Membership Type Duration Unit') ,
314 'description' => 'Unit in which membership period is expressed.',
316 'size' => CRM_Utils_Type
::EIGHT
,
317 'table_name' => 'civicrm_membership_type',
318 'entity' => 'MembershipType',
319 'bao' => 'CRM_Member_BAO_MembershipType',
324 'pseudoconstant' => array(
325 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
328 'duration_interval' => array(
329 'name' => 'duration_interval',
330 'type' => CRM_Utils_Type
::T_INT
,
331 'title' => ts('Membership Type Duration Interval') ,
332 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).',
333 'table_name' => 'civicrm_membership_type',
334 'entity' => 'MembershipType',
335 'bao' => 'CRM_Member_BAO_MembershipType',
338 'period_type' => array(
339 'name' => 'period_type',
340 'type' => CRM_Utils_Type
::T_STRING
,
341 'title' => ts('Membership Type Plan') ,
342 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.',
344 'size' => CRM_Utils_Type
::EIGHT
,
345 'table_name' => 'civicrm_membership_type',
346 'entity' => 'MembershipType',
347 'bao' => 'CRM_Member_BAO_MembershipType',
349 'pseudoconstant' => array(
350 'callback' => 'CRM_Core_SelectValues::periodType',
353 'fixed_period_start_day' => array(
354 'name' => 'fixed_period_start_day',
355 'type' => CRM_Utils_Type
::T_INT
,
356 'title' => ts('Fixed Period Start Day') ,
357 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.',
358 'table_name' => 'civicrm_membership_type',
359 'entity' => 'MembershipType',
360 'bao' => 'CRM_Member_BAO_MembershipType',
363 'fixed_period_rollover_day' => array(
364 'name' => 'fixed_period_rollover_day',
365 'type' => CRM_Utils_Type
::T_INT
,
366 'title' => ts('Fixed Period Rollover Day') ,
367 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.',
368 'table_name' => 'civicrm_membership_type',
369 'entity' => 'MembershipType',
370 'bao' => 'CRM_Member_BAO_MembershipType',
373 'relationship_type_id' => array(
374 'name' => 'relationship_type_id',
375 'type' => CRM_Utils_Type
::T_STRING
,
376 'title' => ts('Membership Type Relationship') ,
377 'description' => 'FK to Relationship Type ID',
379 'size' => CRM_Utils_Type
::BIG
,
380 'table_name' => 'civicrm_membership_type',
381 'entity' => 'MembershipType',
382 'bao' => 'CRM_Member_BAO_MembershipType',
385 'relationship_direction' => array(
386 'name' => 'relationship_direction',
387 'type' => CRM_Utils_Type
::T_STRING
,
388 'title' => ts('Relationship Direction') ,
390 'size' => CRM_Utils_Type
::HUGE
,
391 'table_name' => 'civicrm_membership_type',
392 'entity' => 'MembershipType',
393 'bao' => 'CRM_Member_BAO_MembershipType',
396 'max_related' => array(
397 'name' => 'max_related',
398 'type' => CRM_Utils_Type
::T_INT
,
399 'title' => ts('Max Related Members for Type') ,
400 'description' => 'Maximum number of related memberships.',
401 'table_name' => 'civicrm_membership_type',
402 'entity' => 'MembershipType',
403 'bao' => 'CRM_Member_BAO_MembershipType',
406 'visibility' => array(
407 'name' => 'visibility',
408 'type' => CRM_Utils_Type
::T_STRING
,
409 'title' => ts('Visible') ,
411 'size' => CRM_Utils_Type
::BIG
,
412 'table_name' => 'civicrm_membership_type',
413 'entity' => 'MembershipType',
414 'bao' => 'CRM_Member_BAO_MembershipType',
419 'pseudoconstant' => array(
420 'callback' => 'CRM_Core_SelectValues::memberVisibility',
425 'type' => CRM_Utils_Type
::T_INT
,
426 'title' => ts('Order') ,
427 'table_name' => 'civicrm_membership_type',
428 'entity' => 'MembershipType',
429 'bao' => 'CRM_Member_BAO_MembershipType',
432 'receipt_text_signup' => array(
433 'name' => 'receipt_text_signup',
434 'type' => CRM_Utils_Type
::T_STRING
,
435 'title' => ts('Membership Type Receipt Text') ,
436 'description' => 'Receipt Text for membership signup',
438 'size' => CRM_Utils_Type
::HUGE
,
439 'table_name' => 'civicrm_membership_type',
440 'entity' => 'MembershipType',
441 'bao' => 'CRM_Member_BAO_MembershipType',
444 'type' => 'TextArea',
447 'receipt_text_renewal' => array(
448 'name' => 'receipt_text_renewal',
449 'type' => CRM_Utils_Type
::T_STRING
,
450 'title' => ts('Membership Type Renewal Text') ,
451 'description' => 'Receipt Text for membership renewal',
453 'size' => CRM_Utils_Type
::HUGE
,
454 'table_name' => 'civicrm_membership_type',
455 'entity' => 'MembershipType',
456 'bao' => 'CRM_Member_BAO_MembershipType',
459 'type' => 'TextArea',
462 'auto_renew' => array(
463 'name' => 'auto_renew',
464 'type' => CRM_Utils_Type
::T_BOOLEAN
,
465 'title' => ts('Auto Renew') ,
466 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;',
467 'table_name' => 'civicrm_membership_type',
468 'entity' => 'MembershipType',
469 'bao' => 'CRM_Member_BAO_MembershipType',
471 'pseudoconstant' => array(
472 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
475 'is_active' => array(
476 'name' => 'is_active',
477 'type' => CRM_Utils_Type
::T_BOOLEAN
,
478 'title' => ts('Is Active') ,
479 'description' => 'Is this membership_type enabled',
481 'table_name' => 'civicrm_membership_type',
482 'entity' => 'MembershipType',
483 'bao' => 'CRM_Member_BAO_MembershipType',
487 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
489 return Civi
::$statics[__CLASS__
]['fields'];
492 * Return a mapping from field-name to the corresponding key (as used in fields()).
495 * Array(string $name => string $uniqueName).
497 static function &fieldKeys() {
498 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
499 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
501 return Civi
::$statics[__CLASS__
]['fieldKeys'];
504 * Returns the names of this table
508 static function getTableName() {
509 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
512 * Returns if this table needs to be logged
520 * Returns the list of fields that can be imported
522 * @param bool $prefix
526 static function &import($prefix = false) {
527 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, array());
531 * Returns the list of fields that can be exported
533 * @param bool $prefix
537 static function &export($prefix = false) {
538 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, array());
542 * Returns the list of indices
544 public static function indices($localize = TRUE) {
546 'index_relationship_type_id' => array(
547 'name' => 'index_relationship_type_id',
549 0 => 'relationship_type_id',
551 'localizable' => false,
552 'sig' => 'civicrm_membership_type::0::relationship_type_id',
555 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;