Merge pull request #19061 from christianwach/lab-core-2217
[civicrm-core.git] / xml / schema / Member / Membership.xml
CommitLineData
6a488035
TO
1<?xml version="1.0" encoding="iso-8859-1" ?>
2
3<table>
4 <base>CRM/Member</base>
5 <class>Membership</class>
6 <name>civicrm_membership</name>
7 <comment>Contact Membership records.</comment>
8 <add>1.5</add>
9 <log>true</log>
449c4e6b 10 <icon>fa-id-badge</icon>
d31fb4e3 11 <component>CiviMember</component>
a7bd99ff 12 <paths>
5c385299 13 <add>civicrm/member/add?reset=1&amp;action=add&amp;context=standalone</add>
a7bd99ff 14 <view>civicrm/contact/view/membership?reset=1&amp;action=view&amp;id=[id]&amp;cid=[contact_id]</view>
5c385299 15 <update>civicrm/contact/view/membership?reset=1&amp;action=update&amp;id=[id]&amp;cid=[contact_id]</update>
a7bd99ff
CW
16 <delete>civicrm/contact/view/membership?reset=1&amp;action=delete&amp;id=[id]&amp;cid=[contact_id]</delete>
17 </paths>
6a488035 18 <field>
5435b737
EM
19 <name>id</name>
20 <uniqueName>membership_id</uniqueName>
21 <type>int unsigned</type>
22 <required>true</required>
23 <import>true</import>
24 <title>Membership ID</title>
25 <headerPattern>/^(m(embership\s)?id)$/i</headerPattern>
26 <comment>Membership Id</comment>
27 <add>1.5</add>
6a488035
TO
28 </field>
29 <primaryKey>
5435b737
EM
30 <name>id</name>
31 <autoincrement>true</autoincrement>
6a488035
TO
32 </primaryKey>
33
34 <field>
5435b737
EM
35 <name>contact_id</name>
36 <uniqueName>membership_contact_id</uniqueName>
37 <type>int unsigned</type>
38 <required>true</required>
39 <title>Contact ID</title>
40 <headerPattern>/contact(.?id)?/i</headerPattern>
41 <dataPattern>/^\d+$/</dataPattern>
42 <import>true</import>
43 <comment>FK to Contact ID</comment>
44 <add>1.5</add>
45 <html>
916b6181 46 <type>EntityRef</type>
5435b737 47 </html>
6a488035 48 </field>
3c7d2158 49 <foreignKey>
5435b737
EM
50 <name>contact_id</name>
51 <table>civicrm_contact</table>
52 <key>id</key>
53 <add>1.5</add>
54 <onDelete>CASCADE</onDelete>
6a488035
TO
55 </foreignKey>
56 <field>
5435b737
EM
57 <name>membership_type_id</name>
58 <type>int unsigned</type>
59 <title>Membership Type Id</title>
60 <import>true</import>
61 <headerPattern>/^(m(embership\s)?type)$/i</headerPattern>
62 <export>false</export>
63 <required>true</required>
64 <comment>FK to Membership Type</comment>
65 <pseudoconstant>
66 <table>civicrm_membership_type</table>
67 <keyColumn>id</keyColumn>
68 <labelColumn>name</labelColumn>
69 </pseudoconstant>
70 <html>
71 <type>Select</type>
03ee227b 72 <label>Membership Type</label>
5435b737
EM
73 </html>
74 <add>1.5</add>
6a488035 75 </field>
3c7d2158 76 <foreignKey>
5435b737
EM
77 <name>membership_type_id</name>
78 <table>civicrm_membership_type</table>
79 <key>id</key>
80 <add>1.5</add>
81 <onDelete>CASCADE</onDelete>
6a488035 82 </foreignKey>
3c7d2158 83 <field>
5435b737
EM
84 <name>join_date</name>
85 <title>Member Since</title>
86 <type>date</type>
87 <import>true</import>
88 <headerPattern>/^join|(j(oin\s)?date)$/i</headerPattern>
89 <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
90 <comment>Beginning of initial membership period (member since...).</comment>
91 <add>1.5</add>
92 <html>
93 <type>Select Date</type>
24317d89 94 <formatType>activityDate</formatType>
5435b737 95 </html>
09ba1975 96 <uniqueName>membership_join_date</uniqueName>
3c7d2158 97 </field>
98 <field>
5435b737
EM
99 <name>start_date</name>
100 <uniqueName>membership_start_date</uniqueName>
101 <title>Membership Start Date</title>
102 <type>date</type>
103 <import>true</import>
104 <headerPattern>/(member(ship)?.)?start(s)?(.date$)?/i</headerPattern>
105 <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
106 <comment>Beginning of current uninterrupted membership period.</comment>
107 <add>1.5</add>
108 <html>
109 <type>Select Date</type>
24317d89 110 <formatType>activityDate</formatType>
5435b737 111 </html>
6a488035 112 </field>
3c7d2158 113 <field>
5435b737
EM
114 <name>end_date</name>
115 <uniqueName>membership_end_date</uniqueName>
116 <title>Membership Expiration Date</title>
117 <type>date</type>
118 <import>true</import>
119 <headerPattern>/(member(ship)?.)?end(s)?(.date$)?/i</headerPattern>
120 <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
121 <comment>Current membership period expire date.</comment>
122 <add>1.5</add>
123 <html>
124 <type>Select Date</type>
24317d89 125 <formatType>activityDate</formatType>
5435b737 126 </html>
3c7d2158 127 </field>
128 <field>
5435b737
EM
129 <name>source</name>
130 <uniqueName>membership_source</uniqueName>
131 <title>Source</title>
132 <import>true</import>
133 <headerPattern>/^(member(ship?))?source$/i</headerPattern>
134 <type>varchar</type>
135 <length>128</length>
136 <add>1.5</add>
137 <html>
138 <type>Text</type>
139 </html>
3c7d2158 140 </field>
6a488035 141 <field>
5435b737
EM
142 <name>status_id</name>
143 <title>Membership Status Id</title>
144 <import>true</import>
145 <headerPattern>/(member(ship|).)?(status)$/i</headerPattern>
146 <type>int unsigned</type>
147 <export>false</export>
148 <required>true</required>
149 <comment>FK to Membership Status</comment>
150 <pseudoconstant>
151 <table>civicrm_membership_status</table>
152 <keyColumn>id</keyColumn>
153 <labelColumn>label</labelColumn>
154 </pseudoconstant>
155 <html>
156 <type>Select</type>
157 </html>
158 <add>1.5</add>
6a488035 159 </field>
3c7d2158 160 <foreignKey>
5435b737
EM
161 <name>status_id</name>
162 <table>civicrm_membership_status</table>
163 <key>id</key>
164 <add>1.5</add>
165 <onDelete>CASCADE</onDelete>
6a488035 166 </foreignKey>
3c7d2158 167 <field>
5435b737 168 <name>is_override</name>
8f67d99a 169 <uniqueName>member_is_override</uniqueName>
5435b737
EM
170 <title>Status Override</title>
171 <import>true</import>
8f67d99a 172 <export>true</export>
5435b737
EM
173 <headerPattern>/override$/i</headerPattern>
174 <type>boolean</type>
175 <comment>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.</comment>
176 <html>
177 <type>CheckBox</type>
178 </html>
179 <add>1.5</add>
3c7d2158 180 </field>
e136f704
O
181 <field>
182 <name>status_override_end_date</name>
183 <title>Status Override End Date</title>
184 <type>date</type>
185 <default>NULL</default>
186 <import>true</import>
187 <comment>Then end date of membership status override if 'Override until selected date' override type is selected.</comment>
188 <add>4.7</add>
189 <html>
190 <type>Select Date</type>
efcda6b9 191 <formatType>activityDate</formatType>
e136f704
O
192 </html>
193 </field>
6a488035 194 <field>
5435b737
EM
195 <name>owner_membership_id</name>
196 <type>int unsigned</type>
011aeb62 197 <title>Primary Member ID</title>
5435b737
EM
198 <comment>Optional FK to Parent Membership.</comment>
199 <export>true</export>
200 <add>1.7</add>
6a488035
TO
201 </field>
202 <foreignKey>
5435b737
EM
203 <name>owner_membership_id</name>
204 <table>civicrm_membership</table>
205 <key>id</key>
206 <add>1.7</add>
207 <onDelete>SET NULL</onDelete>
6a488035
TO
208 </foreignKey>
209 <index>
210 <name>index_owner_membership_id</name>
211 <fieldName>owner_membership_id</fieldName>
212 <add>1.7</add>
213 </index>
214 <field>
5435b737
EM
215 <name>max_related</name>
216 <type>int</type>
217 <comment>Maximum number of related memberships (membership_type override).</comment>
218 <add>4.3</add>
8f67d99a 219 <export>true</export>
5435b737
EM
220 <html>
221 <type>Text</type>
222 </html>
6a488035
TO
223 </field>
224 <field>
5435b737
EM
225 <name>is_test</name>
226 <title>Test</title>
227 <uniqueName>member_is_test</uniqueName>
228 <type>boolean</type>
229 <default>0</default>
230 <import>true</import>
231 <headerPattern>/(is.)?test(.member(ship)?)?/i</headerPattern>
232 <html>
233 <type>CheckBox</type>
234 </html>
6a488035 235 </field>
3c7d2158 236 <field>
5435b737
EM
237 <name>is_pay_later</name>
238 <uniqueName>member_is_pay_later</uniqueName>
239 <title>Is Pay Later</title>
240 <type>boolean</type>
241 <default>0</default>
242 <import>true</import>
243 <headerPattern>/(is.)?(pay(.)?later)$/i</headerPattern>
244 <add>2.1</add>
245 <html>
246 <type>CheckBox</type>
247 </html>
6a488035 248 </field>
3c7d2158 249 <field>
250 <name>contribution_recur_id</name>
8f67d99a 251 <uniqueName>membership_recur_id</uniqueName>
c58f0e40 252 <title>Membership Recurring Contribution</title>
3c7d2158 253 <type>int unsigned</type>
8f67d99a 254 <export>true</export>
3c7d2158 255 <comment>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.</comment>
256 <add>3.3</add>
257 </field>
258 <foreignKey>
259 <name>contribution_recur_id</name>
260 <table>civicrm_contribution_recur</table>
261 <key>id</key>
262 <add>3.3</add>
6a488035
TO
263 <onDelete>SET NULL</onDelete>
264 </foreignKey>
3c7d2158 265 <field>
266 <name>campaign_id</name>
6a488035
TO
267 <uniqueName>member_campaign_id</uniqueName>
268 <type>int unsigned</type>
e1ab2e91 269 <title>Campaign</title>
3c7d2158 270 <import>true</import>
271 <comment>The campaign for which this membership is attached.</comment>
3e3eacd0
CW
272 <pseudoconstant>
273 <table>civicrm_campaign</table>
274 <keyColumn>id</keyColumn>
275 <labelColumn>title</labelColumn>
3e3eacd0 276 </pseudoconstant>
3c7d2158 277 <add>3.4</add>
614d72ec 278 <html>
279 <type>Select</type>
280 </html>
3c7d2158 281 </field>
282 <foreignKey>
283 <name>campaign_id</name>
284 <table>civicrm_campaign</table>
285 <key>id</key>
6a488035
TO
286 <onDelete>SET NULL</onDelete>
287 </foreignKey>
288</table>