Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Member/Membership.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7b66c3b5 | 9 | * (GenCodeChecksum:d80be256fb175b763047883b8694559c) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Membership entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Member_DAO_Membership extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.5'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_membership'; |
c3fc2621 | 25 | |
449c4e6b CW |
26 | /** |
27 | * Icon associated with this entity. | |
28 | * | |
29 | * @var string | |
30 | */ | |
31 | public static $_icon = 'fa-id-badge'; | |
32 | ||
e501603b | 33 | /** |
f41f0342 | 34 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 35 | * |
c3fc2621 | 36 | * @var bool |
e501603b | 37 | */ |
fa45b5b9 | 38 | public static $_log = TRUE; |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Membership Id | |
42 | * | |
e6ca0a57 | 43 | * @var int |
e501603b TO |
44 | */ |
45 | public $id; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * FK to Contact ID | |
49 | * | |
e6ca0a57 | 50 | * @var int |
e501603b TO |
51 | */ |
52 | public $contact_id; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * FK to Membership Type | |
56 | * | |
e6ca0a57 | 57 | * @var int |
e501603b TO |
58 | */ |
59 | public $membership_type_id; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Beginning of initial membership period (member since...). | |
63 | * | |
64 | * @var date | |
65 | */ | |
66 | public $join_date; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Beginning of current uninterrupted membership period. | |
70 | * | |
71 | * @var date | |
72 | */ | |
73 | public $start_date; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * Current membership period expire date. | |
77 | * | |
78 | * @var date | |
79 | */ | |
80 | public $end_date; | |
c3fc2621 | 81 | |
e501603b | 82 | /** |
e501603b TO |
83 | * @var string |
84 | */ | |
85 | public $source; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * FK to Membership Status | |
89 | * | |
e6ca0a57 | 90 | * @var int |
e501603b TO |
91 | */ |
92 | public $status_id; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record. | |
96 | * | |
e6ca0a57 | 97 | * @var bool |
e501603b TO |
98 | */ |
99 | public $is_override; | |
c3fc2621 | 100 | |
e136f704 O |
101 | /** |
102 | * Then end date of membership status override if 'Override until selected date' override type is selected. | |
103 | * | |
104 | * @var date | |
105 | */ | |
106 | public $status_override_end_date; | |
107 | ||
e501603b TO |
108 | /** |
109 | * Optional FK to Parent Membership. | |
110 | * | |
e6ca0a57 | 111 | * @var int |
e501603b TO |
112 | */ |
113 | public $owner_membership_id; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Maximum number of related memberships (membership_type override). | |
117 | * | |
118 | * @var int | |
119 | */ | |
120 | public $max_related; | |
c3fc2621 | 121 | |
e501603b | 122 | /** |
e6ca0a57 | 123 | * @var bool |
e501603b TO |
124 | */ |
125 | public $is_test; | |
c3fc2621 | 126 | |
e501603b | 127 | /** |
e6ca0a57 | 128 | * @var bool |
e501603b TO |
129 | */ |
130 | public $is_pay_later; | |
c3fc2621 | 131 | |
e501603b TO |
132 | /** |
133 | * Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events. | |
134 | * | |
e6ca0a57 | 135 | * @var int |
e501603b TO |
136 | */ |
137 | public $contribution_recur_id; | |
c3fc2621 | 138 | |
e501603b TO |
139 | /** |
140 | * The campaign for which this membership is attached. | |
141 | * | |
e6ca0a57 | 142 | * @var int |
e501603b TO |
143 | */ |
144 | public $campaign_id; | |
c3fc2621 | 145 | |
e501603b | 146 | /** |
f41f0342 | 147 | * Class constructor. |
e501603b | 148 | */ |
c3fc2621 | 149 | public function __construct() { |
e501603b TO |
150 | $this->__table = 'civicrm_membership'; |
151 | parent::__construct(); | |
152 | } | |
c3fc2621 | 153 | |
449c4e6b CW |
154 | /** |
155 | * Returns localized title of this entity. | |
7b66c3b5 AH |
156 | * |
157 | * @param bool $plural | |
158 | * Whether to return the plural version of the title. | |
449c4e6b | 159 | */ |
7b66c3b5 AH |
160 | public static function getEntityTitle($plural = FALSE) { |
161 | return $plural ? ts('Memberships') : ts('Membership'); | |
449c4e6b CW |
162 | } |
163 | ||
e501603b | 164 | /** |
f41f0342 | 165 | * Returns foreign keys and entity references. |
e501603b TO |
166 | * |
167 | * @return array | |
168 | * [CRM_Core_Reference_Interface] | |
169 | */ | |
c3fc2621 | 170 | public static function getReferenceColumns() { |
346aaaba | 171 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 172 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
173 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
174 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id'); | |
175 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_membership_status', 'id'); | |
176 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_membership_id', 'civicrm_membership', 'id'); | |
177 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
178 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 179 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 180 | } |
346aaaba | 181 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 182 | } |
c3fc2621 | 183 | |
e501603b TO |
184 | /** |
185 | * Returns all the column names of this table | |
186 | * | |
187 | * @return array | |
188 | */ | |
c3fc2621 | 189 | public static function &fields() { |
346aaaba | 190 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
191 | Civi::$statics[__CLASS__]['fields'] = [ |
192 | 'membership_id' => [ | |
e501603b TO |
193 | 'name' => 'id', |
194 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 195 | 'title' => ts('Membership ID'), |
215b423e | 196 | 'description' => ts('Membership Id'), |
c3fc2621 CW |
197 | 'required' => TRUE, |
198 | 'import' => TRUE, | |
e501603b TO |
199 | 'where' => 'civicrm_membership.id', |
200 | 'headerPattern' => '/^(m(embership\s)?id)$/i', | |
c3fc2621 | 201 | 'export' => TRUE, |
522a26c9 | 202 | 'table_name' => 'civicrm_membership', |
203 | 'entity' => 'Membership', | |
204 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 205 | 'localizable' => 0, |
a9d0587b | 206 | 'add' => '1.5', |
c3fc2621 CW |
207 | ], |
208 | 'membership_contact_id' => [ | |
e501603b TO |
209 | 'name' => 'contact_id', |
210 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 211 | 'title' => ts('Contact ID'), |
215b423e | 212 | 'description' => ts('FK to Contact ID'), |
c3fc2621 CW |
213 | 'required' => TRUE, |
214 | 'import' => TRUE, | |
e501603b TO |
215 | 'where' => 'civicrm_membership.contact_id', |
216 | 'headerPattern' => '/contact(.?id)?/i', | |
217 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 218 | 'export' => TRUE, |
522a26c9 | 219 | 'table_name' => 'civicrm_membership', |
220 | 'entity' => 'Membership', | |
221 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 222 | 'localizable' => 0, |
e501603b | 223 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 224 | 'html' => [ |
e501603b | 225 | 'type' => 'EntityRef', |
c3fc2621 | 226 | ], |
a9d0587b | 227 | 'add' => '1.5', |
c3fc2621 CW |
228 | ], |
229 | 'membership_type_id' => [ | |
e501603b TO |
230 | 'name' => 'membership_type_id', |
231 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 232 | 'title' => ts('Membership Type Id'), |
215b423e | 233 | 'description' => ts('FK to Membership Type'), |
c3fc2621 CW |
234 | 'required' => TRUE, |
235 | 'import' => TRUE, | |
e501603b TO |
236 | 'where' => 'civicrm_membership.membership_type_id', |
237 | 'headerPattern' => '/^(m(embership\s)?type)$/i', | |
c3fc2621 | 238 | 'export' => FALSE, |
522a26c9 | 239 | 'table_name' => 'civicrm_membership', |
240 | 'entity' => 'Membership', | |
241 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 242 | 'localizable' => 0, |
e501603b | 243 | 'FKClassName' => 'CRM_Member_DAO_MembershipType', |
c3fc2621 | 244 | 'html' => [ |
e501603b | 245 | 'type' => 'Select', |
03ee227b | 246 | 'label' => ts("Membership Type"), |
c3fc2621 CW |
247 | ], |
248 | 'pseudoconstant' => [ | |
e501603b TO |
249 | 'table' => 'civicrm_membership_type', |
250 | 'keyColumn' => 'id', | |
251 | 'labelColumn' => 'name', | |
e6ca0a57 | 252 | ], |
a9d0587b | 253 | 'add' => '1.5', |
c3fc2621 | 254 | ], |
09ba1975 | 255 | 'membership_join_date' => [ |
e501603b TO |
256 | 'name' => 'join_date', |
257 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 258 | 'title' => ts('Member Since'), |
215b423e | 259 | 'description' => ts('Beginning of initial membership period (member since...).'), |
c3fc2621 | 260 | 'import' => TRUE, |
e501603b TO |
261 | 'where' => 'civicrm_membership.join_date', |
262 | 'headerPattern' => '/^join|(j(oin\s)?date)$/i', | |
263 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 264 | 'export' => TRUE, |
522a26c9 | 265 | 'table_name' => 'civicrm_membership', |
266 | 'entity' => 'Membership', | |
267 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 268 | 'localizable' => 0, |
c3fc2621 | 269 | 'html' => [ |
e501603b | 270 | 'type' => 'Select Date', |
24317d89 | 271 | 'formatType' => 'activityDate', |
c3fc2621 | 272 | ], |
a9d0587b | 273 | 'add' => '1.5', |
c3fc2621 CW |
274 | ], |
275 | 'membership_start_date' => [ | |
e501603b TO |
276 | 'name' => 'start_date', |
277 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 278 | 'title' => ts('Membership Start Date'), |
215b423e | 279 | 'description' => ts('Beginning of current uninterrupted membership period.'), |
c3fc2621 | 280 | 'import' => TRUE, |
e501603b TO |
281 | 'where' => 'civicrm_membership.start_date', |
282 | 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i', | |
283 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 284 | 'export' => TRUE, |
522a26c9 | 285 | 'table_name' => 'civicrm_membership', |
286 | 'entity' => 'Membership', | |
287 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 288 | 'localizable' => 0, |
c3fc2621 | 289 | 'html' => [ |
e501603b | 290 | 'type' => 'Select Date', |
24317d89 | 291 | 'formatType' => 'activityDate', |
c3fc2621 | 292 | ], |
a9d0587b | 293 | 'add' => '1.5', |
c3fc2621 CW |
294 | ], |
295 | 'membership_end_date' => [ | |
e501603b TO |
296 | 'name' => 'end_date', |
297 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 298 | 'title' => ts('Membership Expiration Date'), |
215b423e | 299 | 'description' => ts('Current membership period expire date.'), |
c3fc2621 | 300 | 'import' => TRUE, |
e501603b TO |
301 | 'where' => 'civicrm_membership.end_date', |
302 | 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i', | |
303 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 304 | 'export' => TRUE, |
522a26c9 | 305 | 'table_name' => 'civicrm_membership', |
306 | 'entity' => 'Membership', | |
307 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 308 | 'localizable' => 0, |
c3fc2621 | 309 | 'html' => [ |
e501603b | 310 | 'type' => 'Select Date', |
24317d89 | 311 | 'formatType' => 'activityDate', |
c3fc2621 | 312 | ], |
a9d0587b | 313 | 'add' => '1.5', |
c3fc2621 CW |
314 | ], |
315 | 'membership_source' => [ | |
e501603b TO |
316 | 'name' => 'source', |
317 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 318 | 'title' => ts('Source'), |
e501603b TO |
319 | 'maxlength' => 128, |
320 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 321 | 'import' => TRUE, |
e501603b TO |
322 | 'where' => 'civicrm_membership.source', |
323 | 'headerPattern' => '/^(member(ship?))?source$/i', | |
c3fc2621 | 324 | 'export' => TRUE, |
522a26c9 | 325 | 'table_name' => 'civicrm_membership', |
326 | 'entity' => 'Membership', | |
327 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 328 | 'localizable' => 0, |
c3fc2621 | 329 | 'html' => [ |
e501603b | 330 | 'type' => 'Text', |
c3fc2621 | 331 | ], |
a9d0587b | 332 | 'add' => '1.5', |
c3fc2621 CW |
333 | ], |
334 | 'status_id' => [ | |
e501603b TO |
335 | 'name' => 'status_id', |
336 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 337 | 'title' => ts('Membership Status Id'), |
215b423e | 338 | 'description' => ts('FK to Membership Status'), |
c3fc2621 CW |
339 | 'required' => TRUE, |
340 | 'import' => TRUE, | |
e501603b TO |
341 | 'where' => 'civicrm_membership.status_id', |
342 | 'headerPattern' => '/(member(ship|).)?(status)$/i', | |
c3fc2621 | 343 | 'export' => FALSE, |
522a26c9 | 344 | 'table_name' => 'civicrm_membership', |
345 | 'entity' => 'Membership', | |
346 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 347 | 'localizable' => 0, |
e501603b | 348 | 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', |
c3fc2621 | 349 | 'html' => [ |
e501603b | 350 | 'type' => 'Select', |
c3fc2621 CW |
351 | ], |
352 | 'pseudoconstant' => [ | |
e501603b TO |
353 | 'table' => 'civicrm_membership_status', |
354 | 'keyColumn' => 'id', | |
355 | 'labelColumn' => 'label', | |
e6ca0a57 | 356 | ], |
a9d0587b | 357 | 'add' => '1.5', |
c3fc2621 | 358 | ], |
8f67d99a | 359 | 'member_is_override' => [ |
e501603b TO |
360 | 'name' => 'is_override', |
361 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 362 | 'title' => ts('Status Override'), |
215b423e | 363 | 'description' => ts('Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.'), |
c3fc2621 | 364 | 'import' => TRUE, |
e501603b TO |
365 | 'where' => 'civicrm_membership.is_override', |
366 | 'headerPattern' => '/override$/i', | |
c3fc2621 | 367 | 'export' => TRUE, |
522a26c9 | 368 | 'table_name' => 'civicrm_membership', |
369 | 'entity' => 'Membership', | |
370 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 371 | 'localizable' => 0, |
c3fc2621 | 372 | 'html' => [ |
e501603b | 373 | 'type' => 'CheckBox', |
c3fc2621 | 374 | ], |
a9d0587b | 375 | 'add' => '1.5', |
c3fc2621 | 376 | ], |
e136f704 O |
377 | 'status_override_end_date' => [ |
378 | 'name' => 'status_override_end_date', | |
379 | 'type' => CRM_Utils_Type::T_DATE, | |
380 | 'title' => ts('Status Override End Date'), | |
215b423e | 381 | 'description' => ts('Then end date of membership status override if \'Override until selected date\' override type is selected.'), |
e136f704 O |
382 | 'import' => TRUE, |
383 | 'where' => 'civicrm_membership.status_override_end_date', | |
e136f704 O |
384 | 'export' => TRUE, |
385 | 'default' => 'NULL', | |
386 | 'table_name' => 'civicrm_membership', | |
387 | 'entity' => 'Membership', | |
388 | 'bao' => 'CRM_Member_BAO_Membership', | |
389 | 'localizable' => 0, | |
390 | 'html' => [ | |
391 | 'type' => 'Select Date', | |
efcda6b9 | 392 | 'formatType' => 'activityDate', |
e136f704 | 393 | ], |
a9d0587b | 394 | 'add' => '4.7', |
e136f704 | 395 | ], |
c3fc2621 | 396 | 'owner_membership_id' => [ |
e501603b TO |
397 | 'name' => 'owner_membership_id', |
398 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 399 | 'title' => ts('Primary Member ID'), |
215b423e | 400 | 'description' => ts('Optional FK to Parent Membership.'), |
e501603b | 401 | 'where' => 'civicrm_membership.owner_membership_id', |
a36434b9 | 402 | 'export' => TRUE, |
522a26c9 | 403 | 'table_name' => 'civicrm_membership', |
404 | 'entity' => 'Membership', | |
405 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 406 | 'localizable' => 0, |
e501603b | 407 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
a9d0587b | 408 | 'add' => '1.7', |
c3fc2621 CW |
409 | ], |
410 | 'max_related' => [ | |
e501603b TO |
411 | 'name' => 'max_related', |
412 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 413 | 'title' => ts('Max Related'), |
215b423e | 414 | 'description' => ts('Maximum number of related memberships (membership_type override).'), |
a36434b9 | 415 | 'where' => 'civicrm_membership.max_related', |
8f67d99a | 416 | 'export' => TRUE, |
522a26c9 | 417 | 'table_name' => 'civicrm_membership', |
418 | 'entity' => 'Membership', | |
419 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 420 | 'localizable' => 0, |
c3fc2621 | 421 | 'html' => [ |
e501603b | 422 | 'type' => 'Text', |
c3fc2621 | 423 | ], |
a9d0587b | 424 | 'add' => '4.3', |
c3fc2621 CW |
425 | ], |
426 | 'member_is_test' => [ | |
e501603b TO |
427 | 'name' => 'is_test', |
428 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
429 | 'title' => ts('Test'), |
430 | 'import' => TRUE, | |
e501603b TO |
431 | 'where' => 'civicrm_membership.is_test', |
432 | 'headerPattern' => '/(is.)?test(.member(ship)?)?/i', | |
c3fc2621 | 433 | 'export' => TRUE, |
45a83e42 | 434 | 'default' => '0', |
522a26c9 | 435 | 'table_name' => 'civicrm_membership', |
436 | 'entity' => 'Membership', | |
437 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 438 | 'localizable' => 0, |
c3fc2621 | 439 | 'html' => [ |
e501603b | 440 | 'type' => 'CheckBox', |
c3fc2621 | 441 | ], |
a9d0587b | 442 | 'add' => NULL, |
c3fc2621 CW |
443 | ], |
444 | 'member_is_pay_later' => [ | |
e501603b TO |
445 | 'name' => 'is_pay_later', |
446 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
447 | 'title' => ts('Is Pay Later'), |
448 | 'import' => TRUE, | |
e501603b TO |
449 | 'where' => 'civicrm_membership.is_pay_later', |
450 | 'headerPattern' => '/(is.)?(pay(.)?later)$/i', | |
c3fc2621 | 451 | 'export' => TRUE, |
45a83e42 | 452 | 'default' => '0', |
522a26c9 | 453 | 'table_name' => 'civicrm_membership', |
454 | 'entity' => 'Membership', | |
455 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 456 | 'localizable' => 0, |
c3fc2621 | 457 | 'html' => [ |
e501603b | 458 | 'type' => 'CheckBox', |
c3fc2621 | 459 | ], |
a9d0587b | 460 | 'add' => '2.1', |
c3fc2621 | 461 | ], |
8f67d99a | 462 | 'membership_recur_id' => [ |
e501603b TO |
463 | 'name' => 'contribution_recur_id', |
464 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 465 | 'title' => ts('Membership Recurring Contribution'), |
215b423e | 466 | 'description' => ts('Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.'), |
a36434b9 | 467 | 'where' => 'civicrm_membership.contribution_recur_id', |
8f67d99a | 468 | 'export' => TRUE, |
522a26c9 | 469 | 'table_name' => 'civicrm_membership', |
470 | 'entity' => 'Membership', | |
471 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 472 | 'localizable' => 0, |
e501603b | 473 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
a9d0587b | 474 | 'add' => '3.3', |
c3fc2621 CW |
475 | ], |
476 | 'member_campaign_id' => [ | |
e501603b TO |
477 | 'name' => 'campaign_id', |
478 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 479 | 'title' => ts('Campaign'), |
215b423e | 480 | 'description' => ts('The campaign for which this membership is attached.'), |
c3fc2621 | 481 | 'import' => TRUE, |
e501603b | 482 | 'where' => 'civicrm_membership.campaign_id', |
c3fc2621 | 483 | 'export' => TRUE, |
522a26c9 | 484 | 'table_name' => 'civicrm_membership', |
485 | 'entity' => 'Membership', | |
486 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 487 | 'localizable' => 0, |
e501603b | 488 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 489 | 'html' => [ |
e501603b | 490 | 'type' => 'Select', |
c3fc2621 CW |
491 | ], |
492 | 'pseudoconstant' => [ | |
e501603b TO |
493 | 'table' => 'civicrm_campaign', |
494 | 'keyColumn' => 'id', | |
495 | 'labelColumn' => 'title', | |
e6ca0a57 | 496 | ], |
a9d0587b | 497 | 'add' => '3.4', |
c3fc2621 CW |
498 | ], |
499 | ]; | |
346aaaba | 500 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 501 | } |
346aaaba | 502 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 503 | } |
c3fc2621 | 504 | |
e501603b | 505 | /** |
bd8e0b14 | 506 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
507 | * |
508 | * @return array | |
bd8e0b14 | 509 | * Array(string $name => string $uniqueName). |
e501603b | 510 | */ |
c3fc2621 | 511 | public static function &fieldKeys() { |
bd8e0b14 TO |
512 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
513 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 514 | } |
bd8e0b14 | 515 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 516 | } |
c3fc2621 | 517 | |
e501603b TO |
518 | /** |
519 | * Returns the names of this table | |
520 | * | |
521 | * @return string | |
522 | */ | |
c3fc2621 | 523 | public static function getTableName() { |
e501603b TO |
524 | return self::$_tableName; |
525 | } | |
c3fc2621 | 526 | |
e501603b TO |
527 | /** |
528 | * Returns if this table needs to be logged | |
529 | * | |
c3fc2621 | 530 | * @return bool |
e501603b | 531 | */ |
c3fc2621 | 532 | public function getLog() { |
e501603b TO |
533 | return self::$_log; |
534 | } | |
c3fc2621 | 535 | |
e501603b TO |
536 | /** |
537 | * Returns the list of fields that can be imported | |
538 | * | |
539 | * @param bool $prefix | |
540 | * | |
541 | * @return array | |
542 | */ | |
c3fc2621 CW |
543 | public static function &import($prefix = FALSE) { |
544 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 545 | return $r; |
e501603b | 546 | } |
c3fc2621 | 547 | |
e501603b TO |
548 | /** |
549 | * Returns the list of fields that can be exported | |
550 | * | |
551 | * @param bool $prefix | |
552 | * | |
553 | * @return array | |
554 | */ | |
c3fc2621 CW |
555 | public static function &export($prefix = FALSE) { |
556 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 557 | return $r; |
e501603b | 558 | } |
c3fc2621 | 559 | |
e7a6b91a AS |
560 | /** |
561 | * Returns the list of indices | |
c3fc2621 CW |
562 | * |
563 | * @param bool $localize | |
564 | * | |
565 | * @return array | |
e7a6b91a AS |
566 | */ |
567 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
568 | $indices = [ |
569 | 'index_owner_membership_id' => [ | |
e7a6b91a | 570 | 'name' => 'index_owner_membership_id', |
c3fc2621 | 571 | 'field' => [ |
e7a6b91a | 572 | 0 => 'owner_membership_id', |
c3fc2621 CW |
573 | ], |
574 | 'localizable' => FALSE, | |
e7a6b91a | 575 | 'sig' => 'civicrm_membership::0::owner_membership_id', |
c3fc2621 CW |
576 | ], |
577 | ]; | |
e7a6b91a AS |
578 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
579 | } | |
c3fc2621 | 580 | |
e501603b | 581 | } |