Remove always-true-if
[civicrm-core.git] / CRM / Member / StatusOverrideTypes.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * Membership status override types.
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 */
18 class CRM_Member_StatusOverrideTypes {
19 /**
20 * The membership status is not overridden
21 * and its is subject to membership status rules.
22 */
23 const NO = 0;
24
25 /**
26 * The membership will stay at the selected status
27 * and its status is NOT subject to membership
28 * status rules.
29 */
30 const PERMANENT = 1;
31
32 /**
33 * The membership status will stay at the
34 * selected status and it is NOT subject to membership status rules.
35 * However, on the selected date(status_override_end_date),
36 * the status override type will automatically change to "NO" thus then
37 * the membership becomes subject to membership status rules.
38 */
39 const UNTIL_DATE = 2;
40
41 /**
42 * Gets the list of override types
43 * as a list of options to be used
44 * for select input.
45 *
46 * @return array
47 * In ['Type 1 Value' => 'Type 1 Label'] format
48 */
49 public static function getSelectOptions() {
50 return [
51 self::NO => ts('No'),
52 self::PERMANENT => ts('Override Permanently'),
53 self::UNTIL_DATE => ts('Override Until Selected Date'),
54 ];
55 }
56
57 /**
58 * Determines if the override type means
59 * that the membership is overridden or not.
60 * For now, only "NO" type means that the membership
61 * status is not overridden.
62 *
63 * @param $overrideType
64 *
65 * @return bool
66 */
67 public static function isOverridden($overrideType) {
68 if ($overrideType == self::NO) {
69 return FALSE;
70 }
71
72 return TRUE;
73 }
74
75 public static function isNo($overrideType) {
76 if ($overrideType != self::NO) {
77 return FALSE;
78 }
79
80 return TRUE;
81 }
82
83 public static function isPermanent($overrideType) {
84 if ($overrideType != self::PERMANENT) {
85 return FALSE;
86 }
87
88 return TRUE;
89 }
90
91 public static function isUntilDate($overrideType) {
92 if ($overrideType != self::UNTIL_DATE) {
93 return FALSE;
94 }
95
96 return TRUE;
97 }
98
99 }