Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Core/Address.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:9538901568da81bcc055d263793c5177) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_Address constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_Address extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_address'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = true; | |
53 | /** | |
54 | * Unique Address ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * FK to Contact ID | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $contact_id; | |
65 | /** | |
66 | * Which Location does this address belong to. | |
67 | * | |
68 | * @var int unsigned | |
69 | */ | |
70 | public $location_type_id; | |
71 | /** | |
72 | * Is this the primary address. | |
73 | * | |
74 | * @var boolean | |
75 | */ | |
76 | public $is_primary; | |
77 | /** | |
78 | * Is this the billing address. | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | public $is_billing; | |
83 | /** | |
84 | * Concatenation of all routable street address components (prefix, street number, street name, suffix, unit | |
85 | number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail | |
86 | delivery, etc.). | |
87 | * | |
88 | * @var string | |
89 | */ | |
90 | public $street_address; | |
91 | /** | |
92 | * Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112. | |
93 | * | |
94 | * @var int | |
95 | */ | |
96 | public $street_number; | |
97 | /** | |
98 | * Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A | |
99 | * | |
100 | * @var string | |
101 | */ | |
102 | public $street_number_suffix; | |
103 | /** | |
104 | * Directional prefix, e.g. SE Main St, SE is the prefix. | |
105 | * | |
106 | * @var string | |
107 | */ | |
108 | public $street_number_predirectional; | |
109 | /** | |
110 | * Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main. | |
111 | * | |
112 | * @var string | |
113 | */ | |
114 | public $street_name; | |
115 | /** | |
116 | * St, Rd, Dr, etc. | |
117 | * | |
118 | * @var string | |
119 | */ | |
120 | public $street_type; | |
121 | /** | |
122 | * Directional prefix, e.g. Main St S, S is the suffix. | |
123 | * | |
124 | * @var string | |
125 | */ | |
126 | public $street_number_postdirectional; | |
127 | /** | |
128 | * Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200 | |
129 | * | |
130 | * @var string | |
131 | */ | |
132 | public $street_unit; | |
133 | /** | |
134 | * Supplemental Address Information, Line 1 | |
135 | * | |
136 | * @var string | |
137 | */ | |
138 | public $supplemental_address_1; | |
139 | /** | |
140 | * Supplemental Address Information, Line 2 | |
141 | * | |
142 | * @var string | |
143 | */ | |
144 | public $supplemental_address_2; | |
145 | /** | |
146 | * Supplemental Address Information, Line 3 | |
147 | * | |
148 | * @var string | |
149 | */ | |
150 | public $supplemental_address_3; | |
151 | /** | |
152 | * City, Town or Village Name. | |
153 | * | |
154 | * @var string | |
155 | */ | |
156 | public $city; | |
157 | /** | |
158 | * Which County does this address belong to. | |
159 | * | |
160 | * @var int unsigned | |
161 | */ | |
162 | public $county_id; | |
163 | /** | |
164 | * Which State_Province does this address belong to. | |
165 | * | |
166 | * @var int unsigned | |
167 | */ | |
168 | public $state_province_id; | |
169 | /** | |
170 | * Store the suffix, like the +4 part in the USPS system. | |
171 | * | |
172 | * @var string | |
173 | */ | |
174 | public $postal_code_suffix; | |
175 | /** | |
176 | * Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation. | |
177 | * | |
178 | * @var string | |
179 | */ | |
180 | public $postal_code; | |
181 | /** | |
182 | * USPS Bulk mailing code. | |
183 | * | |
184 | * @var string | |
185 | */ | |
186 | public $usps_adc; | |
187 | /** | |
188 | * Which Country does this address belong to. | |
189 | * | |
190 | * @var int unsigned | |
191 | */ | |
192 | public $country_id; | |
193 | /** | |
194 | * Latitude | |
195 | * | |
196 | * @var float | |
197 | */ | |
198 | public $geo_code_1; | |
199 | /** | |
200 | * Longitude | |
201 | * | |
202 | * @var float | |
203 | */ | |
204 | public $geo_code_2; | |
205 | /** | |
206 | * Is this a manually entered geo code | |
207 | * | |
208 | * @var boolean | |
209 | */ | |
210 | public $manual_geo_code; | |
211 | /** | |
212 | * Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6". | |
213 | * | |
214 | * @var string | |
215 | */ | |
216 | public $timezone; | |
217 | /** | |
218 | * | |
219 | * @var string | |
220 | */ | |
221 | public $name; | |
222 | /** | |
223 | * FK to Address ID | |
224 | * | |
225 | * @var int unsigned | |
226 | */ | |
227 | public $master_id; | |
228 | /** | |
f41f0342 | 229 | * Class constructor. |
e501603b TO |
230 | */ |
231 | function __construct() { | |
232 | $this->__table = 'civicrm_address'; | |
233 | parent::__construct(); | |
234 | } | |
235 | /** | |
f41f0342 | 236 | * Returns foreign keys and entity references. |
e501603b TO |
237 | * |
238 | * @return array | |
239 | * [CRM_Core_Reference_Interface] | |
240 | */ | |
241 | static function getReferenceColumns() { | |
346aaaba TO |
242 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
243 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
244 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
245 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'county_id', 'civicrm_county', 'id'); | |
246 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'state_province_id', 'civicrm_state_province', 'id'); | |
247 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); | |
248 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'master_id', 'civicrm_address', 'id'); | |
249 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 250 | } |
346aaaba | 251 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
252 | } |
253 | /** | |
254 | * Returns all the column names of this table | |
255 | * | |
256 | * @return array | |
257 | */ | |
258 | static function &fields() { | |
346aaaba TO |
259 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
260 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
261 | 'id' => array( |
262 | 'name' => 'id', | |
263 | 'type' => CRM_Utils_Type::T_INT, | |
264 | 'title' => ts('Address ID') , | |
265 | 'description' => 'Unique Address ID', | |
266 | 'required' => true, | |
522a26c9 | 267 | 'table_name' => 'civicrm_address', |
268 | 'entity' => 'Address', | |
269 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
270 | ) , |
271 | 'contact_id' => array( | |
272 | 'name' => 'contact_id', | |
273 | 'type' => CRM_Utils_Type::T_INT, | |
274 | 'title' => ts('Contact ID') , | |
275 | 'description' => 'FK to Contact ID', | |
522a26c9 | 276 | 'table_name' => 'civicrm_address', |
277 | 'entity' => 'Address', | |
278 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
279 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
280 | ) , | |
281 | 'location_type_id' => array( | |
282 | 'name' => 'location_type_id', | |
283 | 'type' => CRM_Utils_Type::T_INT, | |
284 | 'title' => ts('Address Location Type') , | |
285 | 'description' => 'Which Location does this address belong to.', | |
522a26c9 | 286 | 'table_name' => 'civicrm_address', |
287 | 'entity' => 'Address', | |
288 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
289 | 'html' => array( |
290 | 'type' => 'Select', | |
291 | ) , | |
292 | 'pseudoconstant' => array( | |
293 | 'table' => 'civicrm_location_type', | |
294 | 'keyColumn' => 'id', | |
295 | 'labelColumn' => 'display_name', | |
296 | ) | |
297 | ) , | |
298 | 'is_primary' => array( | |
299 | 'name' => 'is_primary', | |
300 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
301 | 'title' => ts('Is Address Primary?') , | |
302 | 'description' => 'Is this the primary address.', | |
522a26c9 | 303 | 'table_name' => 'civicrm_address', |
304 | 'entity' => 'Address', | |
305 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
306 | 'html' => array( |
307 | 'type' => 'CheckBox', | |
308 | ) , | |
309 | ) , | |
310 | 'is_billing' => array( | |
311 | 'name' => 'is_billing', | |
312 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
313 | 'title' => ts('Is Billing Address') , | |
314 | 'description' => 'Is this the billing address.', | |
522a26c9 | 315 | 'table_name' => 'civicrm_address', |
316 | 'entity' => 'Address', | |
317 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
318 | 'html' => array( |
319 | 'type' => 'CheckBox', | |
320 | ) , | |
321 | ) , | |
322 | 'street_address' => array( | |
323 | 'name' => 'street_address', | |
324 | 'type' => CRM_Utils_Type::T_STRING, | |
325 | 'title' => ts('Street Address') , | |
326 | 'description' => 'Concatenation of all routable street address components (prefix, street number, street name, suffix, unit | |
327 | number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail | |
328 | delivery, etc.). | |
329 | ', | |
330 | 'maxlength' => 96, | |
331 | 'size' => CRM_Utils_Type::HUGE, | |
332 | 'import' => true, | |
333 | 'where' => 'civicrm_address.street_address', | |
334 | 'headerPattern' => '/(street|address)/i', | |
335 | 'dataPattern' => '/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i', | |
336 | 'export' => true, | |
522a26c9 | 337 | 'table_name' => 'civicrm_address', |
338 | 'entity' => 'Address', | |
339 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
340 | 'html' => array( |
341 | 'type' => 'Text', | |
342 | ) , | |
343 | ) , | |
344 | 'street_number' => array( | |
345 | 'name' => 'street_number', | |
346 | 'type' => CRM_Utils_Type::T_INT, | |
347 | 'title' => ts('Street Number') , | |
348 | 'description' => 'Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.', | |
349 | 'export' => true, | |
350 | 'where' => 'civicrm_address.street_number', | |
351 | 'headerPattern' => '', | |
352 | 'dataPattern' => '', | |
522a26c9 | 353 | 'table_name' => 'civicrm_address', |
354 | 'entity' => 'Address', | |
355 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
356 | 'html' => array( |
357 | 'type' => 'Text', | |
358 | ) , | |
359 | ) , | |
360 | 'street_number_suffix' => array( | |
361 | 'name' => 'street_number_suffix', | |
362 | 'type' => CRM_Utils_Type::T_STRING, | |
363 | 'title' => ts('Street Number Suffix') , | |
364 | 'description' => 'Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A | |
365 | ', | |
366 | 'maxlength' => 8, | |
367 | 'size' => CRM_Utils_Type::EIGHT, | |
368 | 'export' => true, | |
369 | 'where' => 'civicrm_address.street_number_suffix', | |
370 | 'headerPattern' => '', | |
371 | 'dataPattern' => '', | |
522a26c9 | 372 | 'table_name' => 'civicrm_address', |
373 | 'entity' => 'Address', | |
374 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
375 | 'html' => array( |
376 | 'type' => 'Text', | |
377 | ) , | |
378 | ) , | |
379 | 'street_number_predirectional' => array( | |
380 | 'name' => 'street_number_predirectional', | |
381 | 'type' => CRM_Utils_Type::T_STRING, | |
382 | 'title' => ts('Street Direction Prefix') , | |
383 | 'description' => 'Directional prefix, e.g. SE Main St, SE is the prefix.', | |
384 | 'maxlength' => 8, | |
385 | 'size' => CRM_Utils_Type::EIGHT, | |
522a26c9 | 386 | 'table_name' => 'civicrm_address', |
387 | 'entity' => 'Address', | |
388 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
389 | 'html' => array( |
390 | 'type' => 'Text', | |
391 | ) , | |
392 | ) , | |
393 | 'street_name' => array( | |
394 | 'name' => 'street_name', | |
395 | 'type' => CRM_Utils_Type::T_STRING, | |
396 | 'title' => ts('Street Name') , | |
397 | 'description' => 'Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.', | |
398 | 'maxlength' => 64, | |
399 | 'size' => CRM_Utils_Type::BIG, | |
400 | 'export' => true, | |
401 | 'where' => 'civicrm_address.street_name', | |
402 | 'headerPattern' => '', | |
403 | 'dataPattern' => '', | |
522a26c9 | 404 | 'table_name' => 'civicrm_address', |
405 | 'entity' => 'Address', | |
406 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
407 | 'html' => array( |
408 | 'type' => 'Text', | |
409 | ) , | |
410 | ) , | |
411 | 'street_type' => array( | |
412 | 'name' => 'street_type', | |
413 | 'type' => CRM_Utils_Type::T_STRING, | |
414 | 'title' => ts('Street Type') , | |
415 | 'description' => 'St, Rd, Dr, etc.', | |
416 | 'maxlength' => 8, | |
417 | 'size' => CRM_Utils_Type::EIGHT, | |
522a26c9 | 418 | 'table_name' => 'civicrm_address', |
419 | 'entity' => 'Address', | |
420 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
421 | 'html' => array( |
422 | 'type' => 'Text', | |
423 | ) , | |
424 | ) , | |
425 | 'street_number_postdirectional' => array( | |
426 | 'name' => 'street_number_postdirectional', | |
427 | 'type' => CRM_Utils_Type::T_STRING, | |
428 | 'title' => ts('Street Direction Suffix') , | |
429 | 'description' => 'Directional prefix, e.g. Main St S, S is the suffix.', | |
430 | 'maxlength' => 8, | |
431 | 'size' => CRM_Utils_Type::EIGHT, | |
522a26c9 | 432 | 'table_name' => 'civicrm_address', |
433 | 'entity' => 'Address', | |
434 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
435 | 'html' => array( |
436 | 'type' => 'Text', | |
437 | ) , | |
438 | ) , | |
439 | 'street_unit' => array( | |
440 | 'name' => 'street_unit', | |
441 | 'type' => CRM_Utils_Type::T_STRING, | |
442 | 'title' => ts('Street Unit') , | |
443 | 'description' => 'Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200', | |
444 | 'maxlength' => 16, | |
445 | 'size' => CRM_Utils_Type::TWELVE, | |
446 | 'export' => true, | |
447 | 'where' => 'civicrm_address.street_unit', | |
448 | 'headerPattern' => '', | |
449 | 'dataPattern' => '', | |
522a26c9 | 450 | 'table_name' => 'civicrm_address', |
451 | 'entity' => 'Address', | |
452 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
453 | 'html' => array( |
454 | 'type' => 'Text', | |
455 | ) , | |
456 | ) , | |
457 | 'supplemental_address_1' => array( | |
458 | 'name' => 'supplemental_address_1', | |
459 | 'type' => CRM_Utils_Type::T_STRING, | |
460 | 'title' => ts('Supplemental Address 1') , | |
461 | 'description' => 'Supplemental Address Information, Line 1', | |
462 | 'maxlength' => 96, | |
463 | 'size' => CRM_Utils_Type::HUGE, | |
464 | 'import' => true, | |
465 | 'where' => 'civicrm_address.supplemental_address_1', | |
466 | 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', | |
467 | 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', | |
468 | 'export' => true, | |
522a26c9 | 469 | 'table_name' => 'civicrm_address', |
470 | 'entity' => 'Address', | |
471 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
472 | 'html' => array( |
473 | 'type' => 'Text', | |
474 | ) , | |
475 | ) , | |
476 | 'supplemental_address_2' => array( | |
477 | 'name' => 'supplemental_address_2', | |
478 | 'type' => CRM_Utils_Type::T_STRING, | |
479 | 'title' => ts('Supplemental Address 2') , | |
480 | 'description' => 'Supplemental Address Information, Line 2', | |
481 | 'maxlength' => 96, | |
482 | 'size' => CRM_Utils_Type::HUGE, | |
483 | 'import' => true, | |
484 | 'where' => 'civicrm_address.supplemental_address_2', | |
485 | 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', | |
486 | 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', | |
487 | 'export' => true, | |
522a26c9 | 488 | 'table_name' => 'civicrm_address', |
489 | 'entity' => 'Address', | |
490 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
491 | 'html' => array( |
492 | 'type' => 'Text', | |
493 | ) , | |
494 | ) , | |
495 | 'supplemental_address_3' => array( | |
496 | 'name' => 'supplemental_address_3', | |
497 | 'type' => CRM_Utils_Type::T_STRING, | |
498 | 'title' => ts('Supplemental Address 3') , | |
499 | 'description' => 'Supplemental Address Information, Line 3', | |
500 | 'maxlength' => 96, | |
501 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 502 | 'table_name' => 'civicrm_address', |
503 | 'entity' => 'Address', | |
504 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
505 | 'html' => array( |
506 | 'type' => 'Text', | |
507 | ) , | |
508 | ) , | |
509 | 'city' => array( | |
510 | 'name' => 'city', | |
511 | 'type' => CRM_Utils_Type::T_STRING, | |
512 | 'title' => ts('City') , | |
513 | 'description' => 'City, Town or Village Name.', | |
514 | 'maxlength' => 64, | |
515 | 'size' => CRM_Utils_Type::BIG, | |
516 | 'import' => true, | |
517 | 'where' => 'civicrm_address.city', | |
518 | 'headerPattern' => '/city/i', | |
519 | 'dataPattern' => '/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/', | |
520 | 'export' => true, | |
522a26c9 | 521 | 'table_name' => 'civicrm_address', |
522 | 'entity' => 'Address', | |
523 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
524 | 'html' => array( |
525 | 'type' => 'Text', | |
526 | ) , | |
527 | ) , | |
528 | 'county_id' => array( | |
529 | 'name' => 'county_id', | |
530 | 'type' => CRM_Utils_Type::T_INT, | |
531 | 'title' => ts('County') , | |
532 | 'description' => 'Which County does this address belong to.', | |
522a26c9 | 533 | 'table_name' => 'civicrm_address', |
534 | 'entity' => 'Address', | |
535 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
536 | 'FKClassName' => 'CRM_Core_DAO_County', |
537 | 'html' => array( | |
538 | 'type' => 'ChainSelect', | |
539 | ) , | |
540 | 'pseudoconstant' => array( | |
541 | 'table' => 'civicrm_county', | |
542 | 'keyColumn' => 'id', | |
543 | 'labelColumn' => 'name', | |
544 | ) | |
545 | ) , | |
546 | 'state_province_id' => array( | |
547 | 'name' => 'state_province_id', | |
548 | 'type' => CRM_Utils_Type::T_INT, | |
549 | 'title' => ts('State/Province') , | |
550 | 'description' => 'Which State_Province does this address belong to.', | |
522a26c9 | 551 | 'table_name' => 'civicrm_address', |
552 | 'entity' => 'Address', | |
553 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
554 | 'FKClassName' => 'CRM_Core_DAO_StateProvince', |
555 | 'html' => array( | |
556 | 'type' => 'ChainSelect', | |
557 | ) , | |
558 | 'pseudoconstant' => array( | |
559 | 'table' => 'civicrm_state_province', | |
560 | 'keyColumn' => 'id', | |
561 | 'labelColumn' => 'name', | |
562 | ) | |
563 | ) , | |
564 | 'postal_code_suffix' => array( | |
565 | 'name' => 'postal_code_suffix', | |
566 | 'type' => CRM_Utils_Type::T_STRING, | |
567 | 'title' => ts('Postal Code Suffix') , | |
568 | 'description' => 'Store the suffix, like the +4 part in the USPS system.', | |
569 | 'maxlength' => 12, | |
570 | 'size' => 3, | |
571 | 'import' => true, | |
572 | 'where' => 'civicrm_address.postal_code_suffix', | |
573 | 'headerPattern' => '/p(ostal)\sc(ode)\ss(uffix)/i', | |
574 | 'dataPattern' => '/\d?\d{4}(-\d{4})?/', | |
575 | 'export' => true, | |
522a26c9 | 576 | 'table_name' => 'civicrm_address', |
577 | 'entity' => 'Address', | |
578 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
579 | 'html' => array( |
580 | 'type' => 'Text', | |
581 | ) , | |
582 | ) , | |
583 | 'postal_code' => array( | |
584 | 'name' => 'postal_code', | |
585 | 'type' => CRM_Utils_Type::T_STRING, | |
586 | 'title' => ts('Postal Code') , | |
587 | 'description' => 'Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.', | |
588 | 'maxlength' => 64, | |
589 | 'size' => 6, | |
590 | 'import' => true, | |
591 | 'where' => 'civicrm_address.postal_code', | |
592 | 'headerPattern' => '/postal|zip/i', | |
593 | 'dataPattern' => '/\d?\d{4}(-\d{4})?/', | |
594 | 'export' => true, | |
522a26c9 | 595 | 'table_name' => 'civicrm_address', |
596 | 'entity' => 'Address', | |
597 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
598 | 'html' => array( |
599 | 'type' => 'Text', | |
600 | ) , | |
601 | ) , | |
602 | 'usps_adc' => array( | |
603 | 'name' => 'usps_adc', | |
604 | 'type' => CRM_Utils_Type::T_STRING, | |
605 | 'title' => ts('USPS Code') , | |
606 | 'description' => 'USPS Bulk mailing code.', | |
607 | 'maxlength' => 32, | |
608 | 'size' => CRM_Utils_Type::MEDIUM, | |
522a26c9 | 609 | 'table_name' => 'civicrm_address', |
610 | 'entity' => 'Address', | |
611 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
612 | ) , |
613 | 'country_id' => array( | |
614 | 'name' => 'country_id', | |
615 | 'type' => CRM_Utils_Type::T_INT, | |
616 | 'title' => ts('Country') , | |
617 | 'description' => 'Which Country does this address belong to.', | |
522a26c9 | 618 | 'table_name' => 'civicrm_address', |
619 | 'entity' => 'Address', | |
620 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
621 | 'FKClassName' => 'CRM_Core_DAO_Country', |
622 | 'html' => array( | |
623 | 'type' => 'Select', | |
624 | ) , | |
625 | 'pseudoconstant' => array( | |
626 | 'table' => 'civicrm_country', | |
627 | 'keyColumn' => 'id', | |
628 | 'labelColumn' => 'name', | |
629 | 'nameColumn' => 'iso_code', | |
630 | ) | |
631 | ) , | |
632 | 'geo_code_1' => array( | |
633 | 'name' => 'geo_code_1', | |
634 | 'type' => CRM_Utils_Type::T_FLOAT, | |
635 | 'title' => ts('Latitude') , | |
636 | 'description' => 'Latitude', | |
637 | 'import' => true, | |
638 | 'where' => 'civicrm_address.geo_code_1', | |
639 | 'headerPattern' => '/geo/i', | |
640 | 'dataPattern' => '', | |
641 | 'export' => true, | |
522a26c9 | 642 | 'table_name' => 'civicrm_address', |
643 | 'entity' => 'Address', | |
644 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
645 | 'html' => array( |
646 | 'type' => 'Text', | |
647 | ) , | |
648 | ) , | |
649 | 'geo_code_2' => array( | |
650 | 'name' => 'geo_code_2', | |
651 | 'type' => CRM_Utils_Type::T_FLOAT, | |
652 | 'title' => ts('Longitude') , | |
653 | 'description' => 'Longitude', | |
654 | 'import' => true, | |
655 | 'where' => 'civicrm_address.geo_code_2', | |
656 | 'headerPattern' => '/geo/i', | |
657 | 'dataPattern' => '', | |
658 | 'export' => true, | |
522a26c9 | 659 | 'table_name' => 'civicrm_address', |
660 | 'entity' => 'Address', | |
661 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
662 | 'html' => array( |
663 | 'type' => 'Text', | |
664 | ) , | |
665 | ) , | |
666 | 'manual_geo_code' => array( | |
667 | 'name' => 'manual_geo_code', | |
668 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
669 | 'title' => ts('Is manually geocoded') , | |
670 | 'description' => 'Is this a manually entered geo code', | |
522a26c9 | 671 | 'table_name' => 'civicrm_address', |
672 | 'entity' => 'Address', | |
673 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
674 | 'html' => array( |
675 | 'type' => 'CheckBox', | |
676 | ) , | |
677 | ) , | |
678 | 'timezone' => array( | |
679 | 'name' => 'timezone', | |
680 | 'type' => CRM_Utils_Type::T_STRING, | |
681 | 'title' => ts('Timezone') , | |
682 | 'description' => 'Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".', | |
683 | 'maxlength' => 8, | |
684 | 'size' => CRM_Utils_Type::EIGHT, | |
522a26c9 | 685 | 'table_name' => 'civicrm_address', |
686 | 'entity' => 'Address', | |
687 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
688 | 'html' => array( |
689 | 'type' => 'Text', | |
690 | ) , | |
691 | ) , | |
692 | 'address_name' => array( | |
693 | 'name' => 'name', | |
694 | 'type' => CRM_Utils_Type::T_STRING, | |
695 | 'title' => ts('Address Name') , | |
696 | 'maxlength' => 255, | |
697 | 'size' => CRM_Utils_Type::HUGE, | |
698 | 'import' => true, | |
699 | 'where' => 'civicrm_address.name', | |
700 | 'headerPattern' => '/^location|(l(ocation\s)?name)$/i', | |
701 | 'dataPattern' => '/^\w+$/', | |
702 | 'export' => true, | |
522a26c9 | 703 | 'table_name' => 'civicrm_address', |
704 | 'entity' => 'Address', | |
705 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
706 | 'html' => array( |
707 | 'type' => 'Text', | |
708 | ) , | |
709 | ) , | |
710 | 'master_id' => array( | |
711 | 'name' => 'master_id', | |
712 | 'type' => CRM_Utils_Type::T_INT, | |
713 | 'title' => ts('Master Address Belongs To') , | |
714 | 'description' => 'FK to Address ID', | |
715 | 'import' => true, | |
716 | 'where' => 'civicrm_address.master_id', | |
717 | 'headerPattern' => '', | |
718 | 'dataPattern' => '', | |
719 | 'export' => true, | |
522a26c9 | 720 | 'table_name' => 'civicrm_address', |
721 | 'entity' => 'Address', | |
722 | 'bao' => 'CRM_Core_BAO_Address', | |
e501603b TO |
723 | 'FKClassName' => 'CRM_Core_DAO_Address', |
724 | ) , | |
725 | ); | |
346aaaba | 726 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 727 | } |
346aaaba | 728 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
729 | } |
730 | /** | |
bd8e0b14 | 731 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
732 | * |
733 | * @return array | |
bd8e0b14 | 734 | * Array(string $name => string $uniqueName). |
e501603b TO |
735 | */ |
736 | static function &fieldKeys() { | |
bd8e0b14 TO |
737 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
738 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 739 | } |
bd8e0b14 | 740 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
741 | } |
742 | /** | |
743 | * Returns the names of this table | |
744 | * | |
745 | * @return string | |
746 | */ | |
747 | static function getTableName() { | |
748 | return self::$_tableName; | |
749 | } | |
750 | /** | |
751 | * Returns if this table needs to be logged | |
752 | * | |
753 | * @return boolean | |
754 | */ | |
755 | function getLog() { | |
756 | return self::$_log; | |
757 | } | |
758 | /** | |
759 | * Returns the list of fields that can be imported | |
760 | * | |
761 | * @param bool $prefix | |
762 | * | |
763 | * @return array | |
764 | */ | |
765 | static function &import($prefix = false) { | |
60808919 TO |
766 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address', $prefix, array( |
767 | 'CRM_Core_DAO_County', | |
768 | 'CRM_Core_DAO_StateProvince', | |
769 | 'CRM_Core_DAO_Country', | |
770 | )); | |
771 | return $r; | |
e501603b TO |
772 | } |
773 | /** | |
774 | * Returns the list of fields that can be exported | |
775 | * | |
776 | * @param bool $prefix | |
777 | * | |
778 | * @return array | |
779 | */ | |
780 | static function &export($prefix = false) { | |
60808919 TO |
781 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address', $prefix, array( |
782 | 'CRM_Core_DAO_County', | |
783 | 'CRM_Core_DAO_StateProvince', | |
784 | 'CRM_Core_DAO_Country', | |
785 | )); | |
786 | return $r; | |
e501603b TO |
787 | } |
788 | } |