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