CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Member / DAO / MembershipType.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
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. |
13| |
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. |
18| |
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+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Member/MembershipType.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:3518fd802e10d1da771f735a949b4350)
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_membership_type';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = true;
83 /**
84 * Membership Id
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Which Domain is this match entry for
91 *
92 * @var int unsigned
93 */
94 public $domain_id;
95 /**
96 * Name of Membership Type
97 *
98 * @var string
99 */
100 public $name;
101 /**
102 * Description of Membership Type
103 *
104 * @var string
105 */
106 public $description;
107 /**
108 * Owner organization for this membership type. FK to Contact ID
109 *
110 * @var int unsigned
111 */
112 public $member_of_contact_id;
113 /**
114 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
115 *
116 * @var int unsigned
117 */
118 public $financial_type_id;
119 /**
120 * Minimum fee for this membership (0 for free/complimentary memberships).
121 *
122 * @var float
123 */
124 public $minimum_fee;
125 /**
126 * Unit in which membership period is expressed.
127 *
128 * @var string
129 */
130 public $duration_unit;
131 /**
132 * Number of duration units in membership period (e.g. 1 year, 12 months).
133 *
134 * @var int
135 */
136 public $duration_interval;
137 /**
138 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
139 *
140 * @var string
141 */
142 public $period_type;
143 /**
144 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
145 *
146 * @var int
147 */
148 public $fixed_period_start_day;
149 /**
150 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
151 *
152 * @var int
153 */
154 public $fixed_period_rollover_day;
155 /**
156 * FK to Relationship Type ID
157 *
158 * @var string
159 */
160 public $relationship_type_id;
161 /**
162 *
163 * @var string
164 */
165 public $relationship_direction;
166 /**
167 * Maximum number of related memberships.
168 *
169 * @var int
170 */
171 public $max_related;
172 /**
173 *
174 * @var string
175 */
176 public $visibility;
177 /**
178 *
179 * @var int
180 */
181 public $weight;
182 /**
183 * Receipt Text for membership signup
184 *
185 * @var string
186 */
187 public $receipt_text_signup;
188 /**
189 * Receipt Text for membership renewal
190 *
191 * @var string
192 */
193 public $receipt_text_renewal;
194 /**
195 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
196 *
197 * @var boolean
198 */
199 public $auto_renew;
200 /**
201 * Is this membership_type enabled
202 *
203 * @var boolean
204 */
205 public $is_active;
206 /**
207 * class constructor
208 *
209 * @return civicrm_membership_type
210 */
211 function __construct() {
212 $this->__table = 'civicrm_membership_type';
213 parent::__construct();
214 }
215 /**
216 * Returns foreign keys and entity references
217 *
218 * @return array
219 * [CRM_Core_Reference_Interface]
220 */
221 static function getReferenceColumns() {
222 if (!self::$_links) {
223 self::$_links = static ::createReferenceColumns(__CLASS__);
224 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
225 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'member_of_contact_id', 'civicrm_contact', 'id');
226 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
227 }
228 return self::$_links;
229 }
230 /**
231 * Returns all the column names of this table
232 *
233 * @return array
234 */
235 static function &fields() {
236 if (!(self::$_fields)) {
237 self::$_fields = array(
238 'id' => array(
239 'name' => 'id',
240 'type' => CRM_Utils_Type::T_INT,
241 'title' => ts('Membership Type ID') ,
242 'description' => 'Membership Id',
243 'required' => true,
244 ) ,
245 'domain_id' => array(
246 'name' => 'domain_id',
247 'type' => CRM_Utils_Type::T_INT,
248 'title' => ts('Membership Type Domain') ,
249 'description' => 'Which Domain is this match entry for',
250 'required' => true,
251 'FKClassName' => 'CRM_Core_DAO_Domain',
252 'pseudoconstant' => array(
253 'table' => 'civicrm_domain',
254 'keyColumn' => 'id',
255 'labelColumn' => 'name',
256 )
257 ) ,
258 'membership_type' => array(
259 'name' => 'name',
260 'type' => CRM_Utils_Type::T_STRING,
261 'title' => ts('Membership Type') ,
262 'description' => 'Name of Membership Type',
263 'maxlength' => 128,
264 'size' => CRM_Utils_Type::HUGE,
265 'import' => true,
266 'where' => 'civicrm_membership_type.name',
267 'headerPattern' => '',
268 'dataPattern' => '',
269 'export' => true,
270 ) ,
271 'description' => array(
272 'name' => 'description',
273 'type' => CRM_Utils_Type::T_STRING,
274 'title' => ts('Membership Type Description') ,
275 'description' => 'Description of Membership Type',
276 'maxlength' => 255,
277 'size' => CRM_Utils_Type::HUGE,
278 'html' => array(
279 'type' => 'TextArea',
280 ) ,
281 ) ,
282 'member_of_contact_id' => array(
283 'name' => 'member_of_contact_id',
284 'type' => CRM_Utils_Type::T_INT,
285 'title' => ts('Membership Type Organization') ,
286 'description' => 'Owner organization for this membership type. FK to Contact ID',
287 'required' => true,
288 'FKClassName' => 'CRM_Contact_DAO_Contact',
289 ) ,
290 'financial_type_id' => array(
291 'name' => 'financial_type_id',
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Membership Financial Type') ,
294 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id',
295 'required' => true,
296 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
297 'pseudoconstant' => array(
298 'table' => 'civicrm_financial_type',
299 'keyColumn' => 'id',
300 'labelColumn' => 'name',
301 )
302 ) ,
303 'minimum_fee' => array(
304 'name' => 'minimum_fee',
305 'type' => CRM_Utils_Type::T_MONEY,
306 'title' => ts('membership Type Minimum Fee') ,
307 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).',
308 'precision' => array(
309 20,
310 2
311 ) ,
312 ) ,
313 'duration_unit' => array(
314 'name' => 'duration_unit',
315 'type' => CRM_Utils_Type::T_STRING,
316 'title' => ts('Membership Type Duration Unit') ,
317 'description' => 'Unit in which membership period is expressed.',
318 'maxlength' => 8,
319 'size' => CRM_Utils_Type::EIGHT,
320 'html' => array(
321 'type' => 'Select',
322 ) ,
323 'pseudoconstant' => array(
324 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
325 )
326 ) ,
327 'duration_interval' => array(
328 'name' => 'duration_interval',
329 'type' => CRM_Utils_Type::T_INT,
330 'title' => ts('Membership Type Duration Interval') ,
331 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).',
332 ) ,
333 'period_type' => array(
334 'name' => 'period_type',
335 'type' => CRM_Utils_Type::T_STRING,
336 'title' => ts('Membership Type Plan') ,
337 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.',
338 'maxlength' => 8,
339 'size' => CRM_Utils_Type::EIGHT,
340 'pseudoconstant' => array(
341 'callback' => 'CRM_Core_SelectValues::periodType',
342 )
343 ) ,
344 'fixed_period_start_day' => array(
345 'name' => 'fixed_period_start_day',
346 'type' => CRM_Utils_Type::T_INT,
347 'title' => ts('Fixed Period Start Day') ,
348 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.',
349 ) ,
350 'fixed_period_rollover_day' => array(
351 'name' => 'fixed_period_rollover_day',
352 'type' => CRM_Utils_Type::T_INT,
353 'title' => ts('Fixed Period Rollover Day') ,
354 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.',
355 ) ,
356 'relationship_type_id' => array(
357 'name' => 'relationship_type_id',
358 'type' => CRM_Utils_Type::T_STRING,
359 'title' => ts('Membership Type Relationship') ,
360 'description' => 'FK to Relationship Type ID',
361 'maxlength' => 64,
362 'size' => CRM_Utils_Type::BIG,
363 ) ,
364 'relationship_direction' => array(
365 'name' => 'relationship_direction',
366 'type' => CRM_Utils_Type::T_STRING,
367 'title' => ts('Relationship Direction') ,
368 'maxlength' => 128,
369 'size' => CRM_Utils_Type::HUGE,
370 ) ,
371 'max_related' => array(
372 'name' => 'max_related',
373 'type' => CRM_Utils_Type::T_INT,
374 'title' => ts('Max Related Members for Type') ,
375 'description' => 'Maximum number of related memberships.',
376 ) ,
377 'visibility' => array(
378 'name' => 'visibility',
379 'type' => CRM_Utils_Type::T_STRING,
380 'title' => ts('Visible') ,
381 'maxlength' => 64,
382 'size' => CRM_Utils_Type::BIG,
383 'html' => array(
384 'type' => 'Select',
385 ) ,
386 'pseudoconstant' => array(
387 'callback' => 'CRM_Core_SelectValues::memberVisibility',
388 )
389 ) ,
390 'weight' => array(
391 'name' => 'weight',
392 'type' => CRM_Utils_Type::T_INT,
393 'title' => ts('Order') ,
394 ) ,
395 'receipt_text_signup' => array(
396 'name' => 'receipt_text_signup',
397 'type' => CRM_Utils_Type::T_STRING,
398 'title' => ts('Membership Type Receipt Text') ,
399 'description' => 'Receipt Text for membership signup',
400 'maxlength' => 255,
401 'size' => CRM_Utils_Type::HUGE,
402 'html' => array(
403 'type' => 'TextArea',
404 ) ,
405 ) ,
406 'receipt_text_renewal' => array(
407 'name' => 'receipt_text_renewal',
408 'type' => CRM_Utils_Type::T_STRING,
409 'title' => ts('Membership Type Renewal Text') ,
410 'description' => 'Receipt Text for membership renewal',
411 'maxlength' => 255,
412 'size' => CRM_Utils_Type::HUGE,
413 'html' => array(
414 'type' => 'TextArea',
415 ) ,
416 ) ,
417 'auto_renew' => array(
418 'name' => 'auto_renew',
419 'type' => CRM_Utils_Type::T_BOOLEAN,
420 'title' => ts('Auto Renew') ,
421 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;',
422 'pseudoconstant' => array(
423 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
424 )
425 ) ,
426 'is_active' => array(
427 'name' => 'is_active',
428 'type' => CRM_Utils_Type::T_BOOLEAN,
429 'title' => ts('Is Active') ,
430 'description' => 'Is this membership_type enabled',
431 'default' => '1',
432 ) ,
433 );
434 }
435 return self::$_fields;
436 }
437 /**
438 * Returns an array containing, for each field, the arary key used for that
439 * field in self::$_fields.
440 *
441 * @return array
442 */
443 static function &fieldKeys() {
444 if (!(self::$_fieldKeys)) {
445 self::$_fieldKeys = array(
446 'id' => 'id',
447 'domain_id' => 'domain_id',
448 'name' => 'membership_type',
449 'description' => 'description',
450 'member_of_contact_id' => 'member_of_contact_id',
451 'financial_type_id' => 'financial_type_id',
452 'minimum_fee' => 'minimum_fee',
453 'duration_unit' => 'duration_unit',
454 'duration_interval' => 'duration_interval',
455 'period_type' => 'period_type',
456 'fixed_period_start_day' => 'fixed_period_start_day',
457 'fixed_period_rollover_day' => 'fixed_period_rollover_day',
458 'relationship_type_id' => 'relationship_type_id',
459 'relationship_direction' => 'relationship_direction',
460 'max_related' => 'max_related',
461 'visibility' => 'visibility',
462 'weight' => 'weight',
463 'receipt_text_signup' => 'receipt_text_signup',
464 'receipt_text_renewal' => 'receipt_text_renewal',
465 'auto_renew' => 'auto_renew',
466 'is_active' => 'is_active',
467 );
468 }
469 return self::$_fieldKeys;
470 }
471 /**
472 * Returns the names of this table
473 *
474 * @return string
475 */
476 static function getTableName() {
477 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
478 }
479 /**
480 * Returns if this table needs to be logged
481 *
482 * @return boolean
483 */
484 function getLog() {
485 return self::$_log;
486 }
487 /**
488 * Returns the list of fields that can be imported
489 *
490 * @param bool $prefix
491 *
492 * @return array
493 */
494 static function &import($prefix = false) {
495 if (!(self::$_import)) {
496 self::$_import = array();
497 $fields = self::fields();
498 foreach($fields as $name => $field) {
499 if (CRM_Utils_Array::value('import', $field)) {
500 if ($prefix) {
501 self::$_import['membership_type'] = & $fields[$name];
502 } else {
503 self::$_import[$name] = & $fields[$name];
504 }
505 }
506 }
507 }
508 return self::$_import;
509 }
510 /**
511 * Returns the list of fields that can be exported
512 *
513 * @param bool $prefix
514 *
515 * @return array
516 */
517 static function &export($prefix = false) {
518 if (!(self::$_export)) {
519 self::$_export = array();
520 $fields = self::fields();
521 foreach($fields as $name => $field) {
522 if (CRM_Utils_Array::value('export', $field)) {
523 if ($prefix) {
524 self::$_export['membership_type'] = & $fields[$name];
525 } else {
526 self::$_export[$name] = & $fields[$name];
527 }
528 }
529 }
530 }
531 return self::$_export;
532 }
533}