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 | |
929a1c14 | 9 | * (GenCodeChecksum:835c63ea0a55b78d6d115a7a6db5dde2) |
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. | |
156 | */ | |
157 | public static function getEntityTitle() { | |
158 | return ts('Memberships'); | |
159 | } | |
160 | ||
e501603b | 161 | /** |
f41f0342 | 162 | * Returns foreign keys and entity references. |
e501603b TO |
163 | * |
164 | * @return array | |
165 | * [CRM_Core_Reference_Interface] | |
166 | */ | |
c3fc2621 | 167 | public static function getReferenceColumns() { |
346aaaba | 168 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 169 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
170 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
171 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id'); | |
172 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_membership_status', 'id'); | |
173 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_membership_id', 'civicrm_membership', 'id'); | |
174 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
175 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 176 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 177 | } |
346aaaba | 178 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 179 | } |
c3fc2621 | 180 | |
e501603b TO |
181 | /** |
182 | * Returns all the column names of this table | |
183 | * | |
184 | * @return array | |
185 | */ | |
c3fc2621 | 186 | public static function &fields() { |
346aaaba | 187 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
188 | Civi::$statics[__CLASS__]['fields'] = [ |
189 | 'membership_id' => [ | |
e501603b TO |
190 | 'name' => 'id', |
191 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 192 | 'title' => ts('Membership ID'), |
215b423e | 193 | 'description' => ts('Membership Id'), |
c3fc2621 CW |
194 | 'required' => TRUE, |
195 | 'import' => TRUE, | |
e501603b TO |
196 | 'where' => 'civicrm_membership.id', |
197 | 'headerPattern' => '/^(m(embership\s)?id)$/i', | |
c3fc2621 | 198 | 'export' => TRUE, |
522a26c9 | 199 | 'table_name' => 'civicrm_membership', |
200 | 'entity' => 'Membership', | |
201 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 202 | 'localizable' => 0, |
a9d0587b | 203 | 'add' => '1.5', |
c3fc2621 CW |
204 | ], |
205 | 'membership_contact_id' => [ | |
e501603b TO |
206 | 'name' => 'contact_id', |
207 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 208 | 'title' => ts('Contact ID'), |
215b423e | 209 | 'description' => ts('FK to Contact ID'), |
c3fc2621 CW |
210 | 'required' => TRUE, |
211 | 'import' => TRUE, | |
e501603b TO |
212 | 'where' => 'civicrm_membership.contact_id', |
213 | 'headerPattern' => '/contact(.?id)?/i', | |
214 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 215 | 'export' => TRUE, |
522a26c9 | 216 | 'table_name' => 'civicrm_membership', |
217 | 'entity' => 'Membership', | |
218 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 219 | 'localizable' => 0, |
e501603b | 220 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 221 | 'html' => [ |
e501603b | 222 | 'type' => 'EntityRef', |
c3fc2621 | 223 | ], |
a9d0587b | 224 | 'add' => '1.5', |
c3fc2621 CW |
225 | ], |
226 | 'membership_type_id' => [ | |
e501603b TO |
227 | 'name' => 'membership_type_id', |
228 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 229 | 'title' => ts('Membership Type Id'), |
215b423e | 230 | 'description' => ts('FK to Membership Type'), |
c3fc2621 CW |
231 | 'required' => TRUE, |
232 | 'import' => TRUE, | |
e501603b TO |
233 | 'where' => 'civicrm_membership.membership_type_id', |
234 | 'headerPattern' => '/^(m(embership\s)?type)$/i', | |
c3fc2621 | 235 | 'export' => FALSE, |
522a26c9 | 236 | 'table_name' => 'civicrm_membership', |
237 | 'entity' => 'Membership', | |
238 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 239 | 'localizable' => 0, |
e501603b | 240 | 'FKClassName' => 'CRM_Member_DAO_MembershipType', |
c3fc2621 | 241 | 'html' => [ |
e501603b | 242 | 'type' => 'Select', |
03ee227b | 243 | 'label' => ts("Membership Type"), |
c3fc2621 CW |
244 | ], |
245 | 'pseudoconstant' => [ | |
e501603b TO |
246 | 'table' => 'civicrm_membership_type', |
247 | 'keyColumn' => 'id', | |
248 | 'labelColumn' => 'name', | |
e6ca0a57 | 249 | ], |
a9d0587b | 250 | 'add' => '1.5', |
c3fc2621 | 251 | ], |
09ba1975 | 252 | 'membership_join_date' => [ |
e501603b TO |
253 | 'name' => 'join_date', |
254 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 255 | 'title' => ts('Member Since'), |
215b423e | 256 | 'description' => ts('Beginning of initial membership period (member since...).'), |
c3fc2621 | 257 | 'import' => TRUE, |
e501603b TO |
258 | 'where' => 'civicrm_membership.join_date', |
259 | 'headerPattern' => '/^join|(j(oin\s)?date)$/i', | |
260 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 261 | 'export' => TRUE, |
522a26c9 | 262 | 'table_name' => 'civicrm_membership', |
263 | 'entity' => 'Membership', | |
264 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 265 | 'localizable' => 0, |
c3fc2621 | 266 | 'html' => [ |
e501603b | 267 | 'type' => 'Select Date', |
24317d89 | 268 | 'formatType' => 'activityDate', |
c3fc2621 | 269 | ], |
a9d0587b | 270 | 'add' => '1.5', |
c3fc2621 CW |
271 | ], |
272 | 'membership_start_date' => [ | |
e501603b TO |
273 | 'name' => 'start_date', |
274 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 275 | 'title' => ts('Membership Start Date'), |
215b423e | 276 | 'description' => ts('Beginning of current uninterrupted membership period.'), |
c3fc2621 | 277 | 'import' => TRUE, |
e501603b TO |
278 | 'where' => 'civicrm_membership.start_date', |
279 | 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i', | |
280 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 281 | 'export' => TRUE, |
522a26c9 | 282 | 'table_name' => 'civicrm_membership', |
283 | 'entity' => 'Membership', | |
284 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 285 | 'localizable' => 0, |
c3fc2621 | 286 | 'html' => [ |
e501603b | 287 | 'type' => 'Select Date', |
24317d89 | 288 | 'formatType' => 'activityDate', |
c3fc2621 | 289 | ], |
a9d0587b | 290 | 'add' => '1.5', |
c3fc2621 CW |
291 | ], |
292 | 'membership_end_date' => [ | |
e501603b TO |
293 | 'name' => 'end_date', |
294 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 295 | 'title' => ts('Membership Expiration Date'), |
215b423e | 296 | 'description' => ts('Current membership period expire date.'), |
c3fc2621 | 297 | 'import' => TRUE, |
e501603b TO |
298 | 'where' => 'civicrm_membership.end_date', |
299 | 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i', | |
300 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 301 | 'export' => TRUE, |
522a26c9 | 302 | 'table_name' => 'civicrm_membership', |
303 | 'entity' => 'Membership', | |
304 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 305 | 'localizable' => 0, |
c3fc2621 | 306 | 'html' => [ |
e501603b | 307 | 'type' => 'Select Date', |
24317d89 | 308 | 'formatType' => 'activityDate', |
c3fc2621 | 309 | ], |
a9d0587b | 310 | 'add' => '1.5', |
c3fc2621 CW |
311 | ], |
312 | 'membership_source' => [ | |
e501603b TO |
313 | 'name' => 'source', |
314 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 315 | 'title' => ts('Source'), |
e501603b TO |
316 | 'maxlength' => 128, |
317 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 318 | 'import' => TRUE, |
e501603b TO |
319 | 'where' => 'civicrm_membership.source', |
320 | 'headerPattern' => '/^(member(ship?))?source$/i', | |
c3fc2621 | 321 | 'export' => TRUE, |
522a26c9 | 322 | 'table_name' => 'civicrm_membership', |
323 | 'entity' => 'Membership', | |
324 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 325 | 'localizable' => 0, |
c3fc2621 | 326 | 'html' => [ |
e501603b | 327 | 'type' => 'Text', |
c3fc2621 | 328 | ], |
a9d0587b | 329 | 'add' => '1.5', |
c3fc2621 CW |
330 | ], |
331 | 'status_id' => [ | |
e501603b TO |
332 | 'name' => 'status_id', |
333 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 334 | 'title' => ts('Membership Status Id'), |
215b423e | 335 | 'description' => ts('FK to Membership Status'), |
c3fc2621 CW |
336 | 'required' => TRUE, |
337 | 'import' => TRUE, | |
e501603b TO |
338 | 'where' => 'civicrm_membership.status_id', |
339 | 'headerPattern' => '/(member(ship|).)?(status)$/i', | |
c3fc2621 | 340 | 'export' => FALSE, |
522a26c9 | 341 | 'table_name' => 'civicrm_membership', |
342 | 'entity' => 'Membership', | |
343 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 344 | 'localizable' => 0, |
e501603b | 345 | 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', |
c3fc2621 | 346 | 'html' => [ |
e501603b | 347 | 'type' => 'Select', |
c3fc2621 CW |
348 | ], |
349 | 'pseudoconstant' => [ | |
e501603b TO |
350 | 'table' => 'civicrm_membership_status', |
351 | 'keyColumn' => 'id', | |
352 | 'labelColumn' => 'label', | |
e6ca0a57 | 353 | ], |
a9d0587b | 354 | 'add' => '1.5', |
c3fc2621 | 355 | ], |
8f67d99a | 356 | 'member_is_override' => [ |
e501603b TO |
357 | 'name' => 'is_override', |
358 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 359 | 'title' => ts('Status Override'), |
215b423e | 360 | '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 | 361 | 'import' => TRUE, |
e501603b TO |
362 | 'where' => 'civicrm_membership.is_override', |
363 | 'headerPattern' => '/override$/i', | |
c3fc2621 | 364 | 'export' => TRUE, |
522a26c9 | 365 | 'table_name' => 'civicrm_membership', |
366 | 'entity' => 'Membership', | |
367 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 368 | 'localizable' => 0, |
c3fc2621 | 369 | 'html' => [ |
e501603b | 370 | 'type' => 'CheckBox', |
c3fc2621 | 371 | ], |
a9d0587b | 372 | 'add' => '1.5', |
c3fc2621 | 373 | ], |
e136f704 O |
374 | 'status_override_end_date' => [ |
375 | 'name' => 'status_override_end_date', | |
376 | 'type' => CRM_Utils_Type::T_DATE, | |
377 | 'title' => ts('Status Override End Date'), | |
215b423e | 378 | 'description' => ts('Then end date of membership status override if \'Override until selected date\' override type is selected.'), |
e136f704 O |
379 | 'import' => TRUE, |
380 | 'where' => 'civicrm_membership.status_override_end_date', | |
e136f704 O |
381 | 'export' => TRUE, |
382 | 'default' => 'NULL', | |
383 | 'table_name' => 'civicrm_membership', | |
384 | 'entity' => 'Membership', | |
385 | 'bao' => 'CRM_Member_BAO_Membership', | |
386 | 'localizable' => 0, | |
387 | 'html' => [ | |
388 | 'type' => 'Select Date', | |
efcda6b9 | 389 | 'formatType' => 'activityDate', |
e136f704 | 390 | ], |
a9d0587b | 391 | 'add' => '4.7', |
e136f704 | 392 | ], |
c3fc2621 | 393 | 'owner_membership_id' => [ |
e501603b TO |
394 | 'name' => 'owner_membership_id', |
395 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 396 | 'title' => ts('Primary Member ID'), |
215b423e | 397 | 'description' => ts('Optional FK to Parent Membership.'), |
e501603b | 398 | 'where' => 'civicrm_membership.owner_membership_id', |
a36434b9 | 399 | 'export' => TRUE, |
522a26c9 | 400 | 'table_name' => 'civicrm_membership', |
401 | 'entity' => 'Membership', | |
402 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 403 | 'localizable' => 0, |
e501603b | 404 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
a9d0587b | 405 | 'add' => '1.7', |
c3fc2621 CW |
406 | ], |
407 | 'max_related' => [ | |
e501603b TO |
408 | 'name' => 'max_related', |
409 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 410 | 'title' => ts('Max Related'), |
215b423e | 411 | 'description' => ts('Maximum number of related memberships (membership_type override).'), |
a36434b9 | 412 | 'where' => 'civicrm_membership.max_related', |
8f67d99a | 413 | 'export' => TRUE, |
522a26c9 | 414 | 'table_name' => 'civicrm_membership', |
415 | 'entity' => 'Membership', | |
416 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 417 | 'localizable' => 0, |
c3fc2621 | 418 | 'html' => [ |
e501603b | 419 | 'type' => 'Text', |
c3fc2621 | 420 | ], |
a9d0587b | 421 | 'add' => '4.3', |
c3fc2621 CW |
422 | ], |
423 | 'member_is_test' => [ | |
e501603b TO |
424 | 'name' => 'is_test', |
425 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
426 | 'title' => ts('Test'), |
427 | 'import' => TRUE, | |
e501603b TO |
428 | 'where' => 'civicrm_membership.is_test', |
429 | 'headerPattern' => '/(is.)?test(.member(ship)?)?/i', | |
c3fc2621 | 430 | 'export' => TRUE, |
45a83e42 | 431 | 'default' => '0', |
522a26c9 | 432 | 'table_name' => 'civicrm_membership', |
433 | 'entity' => 'Membership', | |
434 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 435 | 'localizable' => 0, |
c3fc2621 | 436 | 'html' => [ |
e501603b | 437 | 'type' => 'CheckBox', |
c3fc2621 | 438 | ], |
a9d0587b | 439 | 'add' => NULL, |
c3fc2621 CW |
440 | ], |
441 | 'member_is_pay_later' => [ | |
e501603b TO |
442 | 'name' => 'is_pay_later', |
443 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
444 | 'title' => ts('Is Pay Later'), |
445 | 'import' => TRUE, | |
e501603b TO |
446 | 'where' => 'civicrm_membership.is_pay_later', |
447 | 'headerPattern' => '/(is.)?(pay(.)?later)$/i', | |
c3fc2621 | 448 | 'export' => TRUE, |
45a83e42 | 449 | 'default' => '0', |
522a26c9 | 450 | 'table_name' => 'civicrm_membership', |
451 | 'entity' => 'Membership', | |
452 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 453 | 'localizable' => 0, |
c3fc2621 | 454 | 'html' => [ |
e501603b | 455 | 'type' => 'CheckBox', |
c3fc2621 | 456 | ], |
a9d0587b | 457 | 'add' => '2.1', |
c3fc2621 | 458 | ], |
8f67d99a | 459 | 'membership_recur_id' => [ |
e501603b TO |
460 | 'name' => 'contribution_recur_id', |
461 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 462 | 'title' => ts('Membership Recurring Contribution'), |
215b423e | 463 | '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 | 464 | 'where' => 'civicrm_membership.contribution_recur_id', |
8f67d99a | 465 | 'export' => TRUE, |
522a26c9 | 466 | 'table_name' => 'civicrm_membership', |
467 | 'entity' => 'Membership', | |
468 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 469 | 'localizable' => 0, |
e501603b | 470 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
a9d0587b | 471 | 'add' => '3.3', |
c3fc2621 CW |
472 | ], |
473 | 'member_campaign_id' => [ | |
e501603b TO |
474 | 'name' => 'campaign_id', |
475 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 476 | 'title' => ts('Campaign'), |
215b423e | 477 | 'description' => ts('The campaign for which this membership is attached.'), |
c3fc2621 | 478 | 'import' => TRUE, |
e501603b | 479 | 'where' => 'civicrm_membership.campaign_id', |
c3fc2621 | 480 | 'export' => TRUE, |
522a26c9 | 481 | 'table_name' => 'civicrm_membership', |
482 | 'entity' => 'Membership', | |
483 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 484 | 'localizable' => 0, |
e501603b | 485 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 486 | 'html' => [ |
e501603b | 487 | 'type' => 'Select', |
c3fc2621 CW |
488 | ], |
489 | 'pseudoconstant' => [ | |
e501603b TO |
490 | 'table' => 'civicrm_campaign', |
491 | 'keyColumn' => 'id', | |
492 | 'labelColumn' => 'title', | |
e6ca0a57 | 493 | ], |
a9d0587b | 494 | 'add' => '3.4', |
c3fc2621 CW |
495 | ], |
496 | ]; | |
346aaaba | 497 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 498 | } |
346aaaba | 499 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 500 | } |
c3fc2621 | 501 | |
e501603b | 502 | /** |
bd8e0b14 | 503 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
504 | * |
505 | * @return array | |
bd8e0b14 | 506 | * Array(string $name => string $uniqueName). |
e501603b | 507 | */ |
c3fc2621 | 508 | public static function &fieldKeys() { |
bd8e0b14 TO |
509 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
510 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 511 | } |
bd8e0b14 | 512 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 513 | } |
c3fc2621 | 514 | |
e501603b TO |
515 | /** |
516 | * Returns the names of this table | |
517 | * | |
518 | * @return string | |
519 | */ | |
c3fc2621 | 520 | public static function getTableName() { |
e501603b TO |
521 | return self::$_tableName; |
522 | } | |
c3fc2621 | 523 | |
e501603b TO |
524 | /** |
525 | * Returns if this table needs to be logged | |
526 | * | |
c3fc2621 | 527 | * @return bool |
e501603b | 528 | */ |
c3fc2621 | 529 | public function getLog() { |
e501603b TO |
530 | return self::$_log; |
531 | } | |
c3fc2621 | 532 | |
e501603b TO |
533 | /** |
534 | * Returns the list of fields that can be imported | |
535 | * | |
536 | * @param bool $prefix | |
537 | * | |
538 | * @return array | |
539 | */ | |
c3fc2621 CW |
540 | public static function &import($prefix = FALSE) { |
541 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 542 | return $r; |
e501603b | 543 | } |
c3fc2621 | 544 | |
e501603b TO |
545 | /** |
546 | * Returns the list of fields that can be exported | |
547 | * | |
548 | * @param bool $prefix | |
549 | * | |
550 | * @return array | |
551 | */ | |
c3fc2621 CW |
552 | public static function &export($prefix = FALSE) { |
553 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 554 | return $r; |
e501603b | 555 | } |
c3fc2621 | 556 | |
e7a6b91a AS |
557 | /** |
558 | * Returns the list of indices | |
c3fc2621 CW |
559 | * |
560 | * @param bool $localize | |
561 | * | |
562 | * @return array | |
e7a6b91a AS |
563 | */ |
564 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
565 | $indices = [ |
566 | 'index_owner_membership_id' => [ | |
e7a6b91a | 567 | 'name' => 'index_owner_membership_id', |
c3fc2621 | 568 | 'field' => [ |
e7a6b91a | 569 | 0 => 'owner_membership_id', |
c3fc2621 CW |
570 | ], |
571 | 'localizable' => FALSE, | |
e7a6b91a | 572 | 'sig' => 'civicrm_membership::0::owner_membership_id', |
c3fc2621 CW |
573 | ], |
574 | ]; | |
e7a6b91a AS |
575 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
576 | } | |
c3fc2621 | 577 | |
e501603b | 578 | } |