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