Use metadata for getOptions abbreviation & include currency symbol
[civicrm-core.git] / xml / schema / Core / Address.xml
CommitLineData
6a488035
TO
1<?xml version="1.0" encoding="iso-8859-1" ?>
2
3<table>
4 <base>CRM/Core</base>
5 <class>Address</class>
6 <name>civicrm_address</name>
046a1321 7 <comment>Stores the physical street / mailing address. This format should be capable of storing ALL international addresses.</comment>
6a488035
TO
8 <add>1.1</add>
9 <log>true</log>
10 <field>
8f069c03
EM
11 <name>id</name>
12 <type>int unsigned</type>
13 <title>Address ID</title>
14 <required>true</required>
15 <comment>Unique Address ID</comment>
16 <add>1.1</add>
6a488035
TO
17 </field>
18 <primaryKey>
8f069c03
EM
19 <name>id</name>
20 <autoincrement>true</autoincrement>
6a488035
TO
21 </primaryKey>
22 <field>
8f069c03
EM
23 <name>contact_id</name>
24 <title>Contact ID</title>
25 <type>int unsigned</type>
26 <comment>FK to Contact ID</comment>
27 <add>2.0</add>
6a488035
TO
28 </field>
29 <foreignKey>
8f069c03
EM
30 <name>contact_id</name>
31 <table>civicrm_contact</table>
32 <key>id</key>
33 <add>2.0</add>
34 <onDelete>CASCADE</onDelete>
6a488035
TO
35 </foreignKey>
36 <field>
8f069c03
EM
37 <name>location_type_id</name>
38 <title>Address Location Type</title>
39 <type>int unsigned</type>
40 <comment>Which Location does this address belong to.</comment>
41 <add>2.0</add>
42 <pseudoconstant>
43 <table>civicrm_location_type</table>
44 <keyColumn>id</keyColumn>
45 <labelColumn>display_name</labelColumn>
46 </pseudoconstant>
47 <html>
48 <type>Select</type>
49 </html>
6a488035
TO
50 </field>
51 <index>
52 <name>index_location_type</name>
53 <fieldName>location_type_id</fieldName>
54 <add>2.0</add>
55 </index>
56 <field>
8f069c03
EM
57 <name>is_primary</name>
58 <title>Is Address Primary?</title>
59 <type>boolean</type>
60 <default>0</default>
61 <comment>Is this the primary address.</comment>
62 <add>2.0</add>
999ab5e1
TM
63 <html>
64 <type>CheckBox</type>
65 </html>
6a488035
TO
66 </field>
67 <index>
68 <name>index_is_primary</name>
69 <fieldName>is_primary</fieldName>
70 <add>2.0</add>
71 </index>
72 <field>
8f069c03
EM
73 <name>is_billing</name>
74 <title>Is Billing Address</title>
75 <type>boolean</type>
76 <default>0</default>
77 <comment>Is this the billing address.</comment>
78 <add>2.0</add>
999ab5e1
TM
79 <html>
80 <type>CheckBox</type>
81 </html>
6a488035
TO
82 </field>
83 <index>
84 <name>index_is_billing</name>
85 <fieldName>is_billing</fieldName>
86 <add>2.0</add>
87 </index>
88 <field>
8f069c03
EM
89 <name>street_address</name>
90 <title>Street Address</title>
91 <type>varchar</type>
92 <length>96</length>
93 <import>true</import>
94 <headerPattern>/(street|address)/i</headerPattern>
95 <dataPattern>/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i</dataPattern>
96 <comment>Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
97 number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
fb607354 98 delivery, etc.).</comment>
8f069c03 99 <add>1.1</add>
999ab5e1
TM
100 <html>
101 <type>Text</type>
102 </html>
6a488035
TO
103 </field>
104 <field>
8f069c03
EM
105 <name>street_number</name>
106 <title>Street Number</title>
107 <type>int</type>
108 <export>true</export>
109 <comment>Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.</comment>
110 <add>1.1</add>
999ab5e1
TM
111 <html>
112 <type>Text</type>
113 </html>
6a488035
TO
114 </field>
115 <field>
8f069c03
EM
116 <name>street_number_suffix</name>
117 <title>Street Number Suffix</title>
118 <type>varchar</type>
119 <length>8</length>
120 <export>true</export>
fb607354 121 <comment>Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A</comment>
8f069c03 122 <add>1.1</add>
999ab5e1
TM
123 <html>
124 <type>Text</type>
125 </html>
6a488035
TO
126 </field>
127 <field>
8f069c03
EM
128 <name>street_number_predirectional</name>
129 <title>Street Direction Prefix</title>
130 <type>varchar</type>
131 <length>8</length>
132 <comment>Directional prefix, e.g. SE Main St, SE is the prefix.</comment>
133 <add>1.1</add>
999ab5e1
TM
134 <html>
135 <type>Text</type>
136 </html>
6a488035
TO
137 </field>
138 <field>
8f069c03
EM
139 <name>street_name</name>
140 <type>varchar</type>
141 <title>Street Name</title>
142 <length>64</length>
143 <export>true</export>
144 <comment>Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.</comment>
145 <add>1.1</add>
999ab5e1
TM
146 <html>
147 <type>Text</type>
148 </html>
6a488035
TO
149 </field>
150 <index>
8f069c03
EM
151 <name>index_street_name</name>
152 <fieldName>street_name</fieldName>
153 <add>1.1</add>
6a488035
TO
154 </index>
155 <field>
8f069c03
EM
156 <name>street_type</name>
157 <title>Street Type</title>
158 <type>varchar</type>
159 <length>8</length>
160 <comment>St, Rd, Dr, etc.</comment>
161 <add>1.1</add>
999ab5e1
TM
162 <html>
163 <type>Text</type>
164 </html>
6a488035
TO
165 </field>
166 <field>
8f069c03
EM
167 <name>street_number_postdirectional</name>
168 <title>Street Direction Suffix</title>
169 <type>varchar</type>
170 <length>8</length>
171 <comment>Directional prefix, e.g. Main St S, S is the suffix.</comment>
172 <add>1.1</add>
999ab5e1
TM
173 <html>
174 <type>Text</type>
175 </html>
6a488035
TO
176 </field>
177 <field>
8f069c03
EM
178 <name>street_unit</name>
179 <title>Street Unit</title>
180 <type>varchar</type>
181 <length>16</length>
182 <export>true</export>
183 <comment>Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200</comment>
184 <add>1.1</add>
999ab5e1
TM
185 <html>
186 <type>Text</type>
187 </html>
6a488035
TO
188 </field>
189 <field>
8f069c03
EM
190 <name>supplemental_address_1</name>
191 <title>Supplemental Address 1</title>
192 <type>varchar</type>
193 <length>96</length>
194 <import>true</import>
195 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
196 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
197 <comment>Supplemental Address Information, Line 1</comment>
198 <add>1.1</add>
999ab5e1
TM
199 <html>
200 <type>Text</type>
201 </html>
6a488035
TO
202 </field>
203 <field>
8f069c03
EM
204 <name>supplemental_address_2</name>
205 <title>Supplemental Address 2</title>
206 <type>varchar</type>
207 <length>96</length>
208 <import>true</import>
209 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
210 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
211 <comment>Supplemental Address Information, Line 2</comment>
212 <add>1.1</add>
999ab5e1
TM
213 <html>
214 <type>Text</type>
215 </html>
6a488035
TO
216 </field>
217 <field>
8f069c03
EM
218 <name>supplemental_address_3</name>
219 <title>Supplemental Address 3</title>
220 <type>varchar</type>
221 <length>96</length>
207f62c6
AS
222 <import>true</import>
223 <headerPattern>/(supplemental(\s)?)?address(\s\d+)?/i</headerPattern>
224 <dataPattern>/unit|ap(ar)?t(ment)?\s(\d|\w)+/i</dataPattern>
8f069c03
EM
225 <comment>Supplemental Address Information, Line 3</comment>
226 <add>1.1</add>
999ab5e1
TM
227 <html>
228 <type>Text</type>
229 </html>
6a488035
TO
230 </field>
231 <field>
8f069c03
EM
232 <name>city</name>
233 <title>City</title>
234 <type>varchar</type>
235 <length>64</length>
236 <import>true</import>
237 <headerPattern>/city/i</headerPattern>
238 <dataPattern>/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/</dataPattern>
239 <comment>City, Town or Village Name.</comment>
240 <add>1.1</add>
999ab5e1
TM
241 <html>
242 <type>Text</type>
243 </html>
6a488035
TO
244 </field>
245 <index>
8f069c03
EM
246 <name>index_city</name>
247 <fieldName>city</fieldName>
248 <add>1.1</add>
6a488035
TO
249 </index>
250 <field>
8f069c03
EM
251 <name>county_id</name>
252 <type>int unsigned</type>
253 <title>County</title>
254 <comment>Which County does this address belong to.</comment>
255 <pseudoconstant>
256 <table>civicrm_county</table>
257 <keyColumn>id</keyColumn>
258 <labelColumn>name</labelColumn>
259 </pseudoconstant>
260 <html>
b248d52b 261 <type>ChainSelect</type>
8f069c03
EM
262 </html>
263 <add>1.1</add>
6a488035
TO
264 </field>
265 <foreignKey>
8f069c03
EM
266 <name>county_id</name>
267 <table>civicrm_county</table>
268 <key>id</key>
269 <import>true</import>
270 <headerPattern>/county/i</headerPattern>
271 <dataPattern>/[A-Z]{2}/</dataPattern>
272 <add>1.1</add>
273 <onDelete>SET NULL</onDelete>
6a488035
TO
274 </foreignKey>
275 <field>
8f069c03 276 <name>state_province_id</name>
b248d52b 277 <title>State/Province</title>
8f069c03
EM
278 <type>int unsigned</type>
279 <comment>Which State_Province does this address belong to.</comment>
280 <pseudoconstant>
281 <table>civicrm_state_province</table>
282 <keyColumn>id</keyColumn>
283 <labelColumn>name</labelColumn>
284 </pseudoconstant>
65c86f7d 285 <localize_context>province</localize_context>
8f069c03 286 <html>
b248d52b 287 <type>ChainSelect</type>
8f069c03
EM
288 </html>
289 <add>1.1</add>
6a488035
TO
290 </field>
291 <foreignKey>
8f069c03
EM
292 <name>state_province_id</name>
293 <table>civicrm_state_province</table>
294 <key>id</key>
295 <import>true</import>
296 <headerPattern>/state|prov(ince)?/i</headerPattern>
297 <dataPattern>
298 /A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY]/i
299 </dataPattern>
300 <add>1.1</add>
301 <onDelete>SET NULL</onDelete>
6a488035 302 </foreignKey>
8f069c03
EM
303 <field>
304 <name>postal_code_suffix</name>
d79be26c 305 <title>Postal Code Suffix</title>
8f069c03
EM
306 <type>varchar</type>
307 <length>12</length>
308 <import>true</import>
309 <headerPattern>/p(ostal)\sc(ode)\ss(uffix)/i</headerPattern>
310 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
311 <comment>Store the suffix, like the +4 part in the USPS system.</comment>
312 <add>1.1</add>
999ab5e1
TM
313 <html>
314 <type>Text</type>
d79be26c 315 <size>3</size>
999ab5e1 316 </html>
3c7d2158 317 </field>
8f069c03
EM
318 <field>
319 <name>postal_code</name>
d79be26c 320 <title>Postal Code</title>
8f069c03 321 <type>varchar</type>
c5219185 322 <length>64</length>
8f069c03
EM
323 <import>true</import>
324 <headerPattern>/postal|zip/i</headerPattern>
325 <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
d79be26c 326 <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.</comment>
8f069c03 327 <add>1.1</add>
999ab5e1
TM
328 <html>
329 <type>Text</type>
d79be26c 330 <size>6</size>
999ab5e1 331 </html>
6a488035
TO
332 </field>
333 <field>
8f069c03
EM
334 <name>usps_adc</name>
335 <title>USPS Code</title>
336 <type>varchar</type>
337 <length>32</length>
338 <comment>USPS Bulk mailing code.</comment>
339 <add>1.1</add>
6a488035
TO
340 </field>
341 <field>
8f069c03
EM
342 <name>country_id</name>
343 <title>Country</title>
344 <type>int unsigned</type>
345 <comment>Which Country does this address belong to.</comment>
346 <pseudoconstant>
347 <table>civicrm_country</table>
348 <keyColumn>id</keyColumn>
349 <labelColumn>name</labelColumn>
350 <nameColumn>iso_code</nameColumn>
a8fdb24e 351 <abbrColumn>iso_code</abbrColumn>
8f069c03 352 </pseudoconstant>
65c86f7d 353 <localize_context>country</localize_context>
8f069c03
EM
354 <html>
355 <type>Select</type>
356 </html>
357 <add>1.1</add>
6a488035
TO
358 </field>
359 <foreignKey>
8f069c03
EM
360 <name>country_id</name>
361 <table>civicrm_country</table>
362 <key>id</key>
363 <import>true</import>
364 <headerPattern>/country/i</headerPattern>
365 <dataPattern>/\w+(\s\w+)?/</dataPattern>
366 <add>1.1</add>
367 <onDelete>SET NULL</onDelete>
6a488035
TO
368 </foreignKey>
369 <field>
8f069c03
EM
370 <name>geo_code_1</name>
371 <title>Latitude</title>
372 <type>float</type>
373 <import>true</import>
374 <headerPattern>/geo/i</headerPattern>
375 <comment>Latitude</comment>
376 <add>1.1</add>
999ab5e1
TM
377 <html>
378 <type>Text</type>
379 <size>9</size>
380 </html>
6a488035
TO
381 </field>
382 <field>
8f069c03
EM
383 <name>geo_code_2</name>
384 <title>Longitude</title>
385 <type>float</type>
386 <comment>Longitude</comment>
387 <import>true</import>
388 <headerPattern>/geo/i</headerPattern>
389 <add>1.1</add>
999ab5e1
TM
390 <html>
391 <type>Text</type>
392 <size>9</size>
393 </html>
6a488035
TO
394 </field>
395 <field>
8f069c03
EM
396 <name>manual_geo_code</name>
397 <title>Is manually geocoded</title>
398 <type>boolean</type>
399 <default>0</default>
400 <comment>Is this a manually entered geo code</comment>
401 <add>4.3</add>
999ab5e1
TM
402 <html>
403 <type>CheckBox</type>
404 </html>
6a488035
TO
405 </field>
406 <field>
8f069c03
EM
407 <name>timezone</name>
408 <title>Timezone</title>
409 <type>varchar</type>
410 <length>8</length>
411 <comment>Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".</comment>
412 <add>1.1</add>
999ab5e1
TM
413 <html>
414 <type>Text</type>
415 </html>
6a488035
TO
416 </field>
417 <field>
8f069c03
EM
418 <name>name</name>
419 <uniqueName>address_name</uniqueName>
420 <title>Address Name</title>
421 <type>varchar</type>
422 <length>255</length>
423 <import>true</import>
424 <headerPattern>/^location|(l(ocation\s)?name)$/i</headerPattern>
425 <dataPattern>/^\w+$/</dataPattern>
426 <add>2.1</add>
999ab5e1
TM
427 <html>
428 <type>Text</type>
429 </html>
6a488035
TO
430 </field>
431 <field>
8f069c03
EM
432 <name>master_id</name>
433 <title>Master Address Belongs To</title>
434 <type>int unsigned</type>
435 <import>true</import>
436 <comment>FK to Address ID</comment>
437 <add>3.3</add>
6a488035
TO
438 </field>
439 <foreignKey>
8f069c03
EM
440 <name>master_id</name>
441 <table>civicrm_address</table>
442 <key>id</key>
443 <add>3.3</add>
444 <onDelete>SET NULL</onDelete>
6a488035
TO
445 </foreignKey>
446</table>