Commit | Line | Data |
---|---|---|
e136f704 O |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
e136f704 | 5 | +--------------------------------------------------------------------+ |
6b83d5bd | 6 | | Copyright CiviCRM LLC (c) 2004-2019 | |
e136f704 O |
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 | /** | |
29 | * Membership status override types. | |
30 | * | |
31 | * @package CRM | |
6b83d5bd | 32 | * @copyright CiviCRM LLC (c) 2004-2019 |
e136f704 O |
33 | * |
34 | */ | |
35 | class CRM_Member_StatusOverrideTypes { | |
36 | /** | |
37 | * The membership status is not overridden | |
38 | * and its is subject to membership status rules. | |
39 | */ | |
40 | const NO = 0; | |
41 | ||
42 | /** | |
43 | * The membership will stay at the selected status | |
44 | * and its status is NOT subject to membership | |
45 | * status rules. | |
46 | */ | |
47 | const PERMANENT = 1; | |
48 | ||
49 | /** | |
50 | * The membership status will stay at the | |
51 | * selected status and it is NOT subject to membership status rules. | |
52 | * However, on the selected date(status_override_end_date), | |
53 | * the status override type will automatically change to "NO" thus then | |
54 | * the membership becomes subject to membership status rules. | |
55 | */ | |
56 | const UNTIL_DATE = 2; | |
57 | ||
58 | /** | |
59 | * Gets the list of override types | |
60 | * as a list of options to be used | |
61 | * for select input. | |
62 | * | |
63 | * @return array | |
64 | * In ['Type 1 Value' => 'Type 1 Label'] format | |
65 | */ | |
66 | public static function getSelectOptions() { | |
be2fb01f | 67 | return [ |
e136f704 O |
68 | self::NO => ts('No'), |
69 | self::PERMANENT => ts('Override Permanently'), | |
70 | self::UNTIL_DATE => ts('Override Until Selected Date'), | |
be2fb01f | 71 | ]; |
e136f704 O |
72 | } |
73 | ||
74 | /** | |
75 | * Determines if the override type means | |
76 | * that the membership is overridden or not. | |
77 | * For now, only "NO" type means that the membership | |
78 | * status is not overridden. | |
79 | * | |
80 | * @param $overrideType | |
81 | * | |
82 | * @return bool | |
83 | */ | |
84 | public static function isOverridden($overrideType) { | |
85 | if ($overrideType == self::NO) { | |
86 | return FALSE; | |
87 | } | |
88 | ||
89 | return TRUE; | |
90 | } | |
91 | ||
92 | public static function isNo($overrideType) { | |
93 | if ($overrideType != self::NO) { | |
94 | return FALSE; | |
95 | } | |
96 | ||
97 | return TRUE; | |
98 | } | |
99 | ||
100 | public static function isPermanent($overrideType) { | |
101 | if ($overrideType != self::PERMANENT) { | |
102 | return FALSE; | |
103 | } | |
104 | ||
105 | return TRUE; | |
106 | } | |
107 | ||
108 | public static function isUntilDate($overrideType) { | |
109 | if ($overrideType != self::UNTIL_DATE) { | |
110 | return FALSE; | |
111 | } | |
112 | ||
113 | return TRUE; | |
114 | } | |
115 | ||
116 | } |