CRM-20312 regenerated DAO with localisation
[civicrm-core.git] / CRM / Core / DAO / Address.php
CommitLineData
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 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_Address constructor.
39 */
e501603b
TO
40class 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',
6a7e5e5d 270 'localizable' => 0,
e501603b
TO
271 ) ,
272 'contact_id' => array(
273 'name' => 'contact_id',
274 'type' => CRM_Utils_Type::T_INT,
275 'title' => ts('Contact ID') ,
276 'description' => 'FK to Contact ID',
522a26c9 277 'table_name' => 'civicrm_address',
278 'entity' => 'Address',
279 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 280 'localizable' => 0,
e501603b
TO
281 'FKClassName' => 'CRM_Contact_DAO_Contact',
282 ) ,
283 'location_type_id' => array(
284 'name' => 'location_type_id',
285 'type' => CRM_Utils_Type::T_INT,
286 'title' => ts('Address Location Type') ,
287 'description' => 'Which Location does this address belong to.',
522a26c9 288 'table_name' => 'civicrm_address',
289 'entity' => 'Address',
290 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 291 'localizable' => 0,
e501603b
TO
292 'html' => array(
293 'type' => 'Select',
294 ) ,
295 'pseudoconstant' => array(
296 'table' => 'civicrm_location_type',
297 'keyColumn' => 'id',
298 'labelColumn' => 'display_name',
299 )
300 ) ,
301 'is_primary' => array(
302 'name' => 'is_primary',
303 'type' => CRM_Utils_Type::T_BOOLEAN,
304 'title' => ts('Is Address Primary?') ,
305 'description' => 'Is this the primary address.',
522a26c9 306 'table_name' => 'civicrm_address',
307 'entity' => 'Address',
308 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 309 'localizable' => 0,
e501603b
TO
310 'html' => array(
311 'type' => 'CheckBox',
312 ) ,
313 ) ,
314 'is_billing' => array(
315 'name' => 'is_billing',
316 'type' => CRM_Utils_Type::T_BOOLEAN,
317 'title' => ts('Is Billing Address') ,
318 'description' => 'Is this the billing address.',
522a26c9 319 'table_name' => 'civicrm_address',
320 'entity' => 'Address',
321 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 322 'localizable' => 0,
e501603b
TO
323 'html' => array(
324 'type' => 'CheckBox',
325 ) ,
326 ) ,
327 'street_address' => array(
328 'name' => 'street_address',
329 'type' => CRM_Utils_Type::T_STRING,
330 'title' => ts('Street Address') ,
331 'description' => 'Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
332 number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
333 delivery, etc.).
334 ',
335 'maxlength' => 96,
336 'size' => CRM_Utils_Type::HUGE,
337 'import' => true,
338 'where' => 'civicrm_address.street_address',
339 'headerPattern' => '/(street|address)/i',
340 'dataPattern' => '/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i',
341 'export' => true,
522a26c9 342 'table_name' => 'civicrm_address',
343 'entity' => 'Address',
344 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 345 'localizable' => 0,
e501603b
TO
346 'html' => array(
347 'type' => 'Text',
348 ) ,
349 ) ,
350 'street_number' => array(
351 'name' => 'street_number',
352 'type' => CRM_Utils_Type::T_INT,
353 'title' => ts('Street Number') ,
354 'description' => 'Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.',
355 'export' => true,
356 'where' => 'civicrm_address.street_number',
357 'headerPattern' => '',
358 'dataPattern' => '',
522a26c9 359 'table_name' => 'civicrm_address',
360 'entity' => 'Address',
361 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 362 'localizable' => 0,
e501603b
TO
363 'html' => array(
364 'type' => 'Text',
365 ) ,
366 ) ,
367 'street_number_suffix' => array(
368 'name' => 'street_number_suffix',
369 'type' => CRM_Utils_Type::T_STRING,
370 'title' => ts('Street Number Suffix') ,
371 'description' => 'Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A
372 ',
373 'maxlength' => 8,
374 'size' => CRM_Utils_Type::EIGHT,
375 'export' => true,
376 'where' => 'civicrm_address.street_number_suffix',
377 'headerPattern' => '',
378 'dataPattern' => '',
522a26c9 379 'table_name' => 'civicrm_address',
380 'entity' => 'Address',
381 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 382 'localizable' => 0,
e501603b
TO
383 'html' => array(
384 'type' => 'Text',
385 ) ,
386 ) ,
387 'street_number_predirectional' => array(
388 'name' => 'street_number_predirectional',
389 'type' => CRM_Utils_Type::T_STRING,
390 'title' => ts('Street Direction Prefix') ,
391 'description' => 'Directional prefix, e.g. SE Main St, SE is the prefix.',
392 'maxlength' => 8,
393 'size' => CRM_Utils_Type::EIGHT,
522a26c9 394 'table_name' => 'civicrm_address',
395 'entity' => 'Address',
396 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 397 'localizable' => 0,
e501603b
TO
398 'html' => array(
399 'type' => 'Text',
400 ) ,
401 ) ,
402 'street_name' => array(
403 'name' => 'street_name',
404 'type' => CRM_Utils_Type::T_STRING,
405 'title' => ts('Street Name') ,
406 'description' => 'Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.',
407 'maxlength' => 64,
408 'size' => CRM_Utils_Type::BIG,
409 'export' => true,
410 'where' => 'civicrm_address.street_name',
411 'headerPattern' => '',
412 'dataPattern' => '',
522a26c9 413 'table_name' => 'civicrm_address',
414 'entity' => 'Address',
415 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 416 'localizable' => 0,
e501603b
TO
417 'html' => array(
418 'type' => 'Text',
419 ) ,
420 ) ,
421 'street_type' => array(
422 'name' => 'street_type',
423 'type' => CRM_Utils_Type::T_STRING,
424 'title' => ts('Street Type') ,
425 'description' => 'St, Rd, Dr, etc.',
426 'maxlength' => 8,
427 'size' => CRM_Utils_Type::EIGHT,
522a26c9 428 'table_name' => 'civicrm_address',
429 'entity' => 'Address',
430 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 431 'localizable' => 0,
e501603b
TO
432 'html' => array(
433 'type' => 'Text',
434 ) ,
435 ) ,
436 'street_number_postdirectional' => array(
437 'name' => 'street_number_postdirectional',
438 'type' => CRM_Utils_Type::T_STRING,
439 'title' => ts('Street Direction Suffix') ,
440 'description' => 'Directional prefix, e.g. Main St S, S is the suffix.',
441 'maxlength' => 8,
442 'size' => CRM_Utils_Type::EIGHT,
522a26c9 443 'table_name' => 'civicrm_address',
444 'entity' => 'Address',
445 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 446 'localizable' => 0,
e501603b
TO
447 'html' => array(
448 'type' => 'Text',
449 ) ,
450 ) ,
451 'street_unit' => array(
452 'name' => 'street_unit',
453 'type' => CRM_Utils_Type::T_STRING,
454 'title' => ts('Street Unit') ,
455 'description' => 'Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200',
456 'maxlength' => 16,
457 'size' => CRM_Utils_Type::TWELVE,
458 'export' => true,
459 'where' => 'civicrm_address.street_unit',
460 'headerPattern' => '',
461 'dataPattern' => '',
522a26c9 462 'table_name' => 'civicrm_address',
463 'entity' => 'Address',
464 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 465 'localizable' => 0,
e501603b
TO
466 'html' => array(
467 'type' => 'Text',
468 ) ,
469 ) ,
470 'supplemental_address_1' => array(
471 'name' => 'supplemental_address_1',
472 'type' => CRM_Utils_Type::T_STRING,
473 'title' => ts('Supplemental Address 1') ,
474 'description' => 'Supplemental Address Information, Line 1',
475 'maxlength' => 96,
476 'size' => CRM_Utils_Type::HUGE,
477 'import' => true,
478 'where' => 'civicrm_address.supplemental_address_1',
479 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i',
480 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i',
481 'export' => true,
522a26c9 482 'table_name' => 'civicrm_address',
483 'entity' => 'Address',
484 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 485 'localizable' => 0,
e501603b
TO
486 'html' => array(
487 'type' => 'Text',
488 ) ,
489 ) ,
490 'supplemental_address_2' => array(
491 'name' => 'supplemental_address_2',
492 'type' => CRM_Utils_Type::T_STRING,
493 'title' => ts('Supplemental Address 2') ,
494 'description' => 'Supplemental Address Information, Line 2',
495 'maxlength' => 96,
496 'size' => CRM_Utils_Type::HUGE,
497 'import' => true,
498 'where' => 'civicrm_address.supplemental_address_2',
499 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i',
500 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i',
501 'export' => true,
522a26c9 502 'table_name' => 'civicrm_address',
503 'entity' => 'Address',
504 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 505 'localizable' => 0,
e501603b
TO
506 'html' => array(
507 'type' => 'Text',
508 ) ,
509 ) ,
510 'supplemental_address_3' => array(
511 'name' => 'supplemental_address_3',
512 'type' => CRM_Utils_Type::T_STRING,
513 'title' => ts('Supplemental Address 3') ,
514 'description' => 'Supplemental Address Information, Line 3',
515 'maxlength' => 96,
516 'size' => CRM_Utils_Type::HUGE,
522a26c9 517 'table_name' => 'civicrm_address',
518 'entity' => 'Address',
519 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 520 'localizable' => 0,
e501603b
TO
521 'html' => array(
522 'type' => 'Text',
523 ) ,
524 ) ,
525 'city' => array(
526 'name' => 'city',
527 'type' => CRM_Utils_Type::T_STRING,
528 'title' => ts('City') ,
529 'description' => 'City, Town or Village Name.',
530 'maxlength' => 64,
531 'size' => CRM_Utils_Type::BIG,
532 'import' => true,
533 'where' => 'civicrm_address.city',
534 'headerPattern' => '/city/i',
535 'dataPattern' => '/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/',
536 'export' => true,
522a26c9 537 'table_name' => 'civicrm_address',
538 'entity' => 'Address',
539 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 540 'localizable' => 0,
e501603b
TO
541 'html' => array(
542 'type' => 'Text',
543 ) ,
544 ) ,
545 'county_id' => array(
546 'name' => 'county_id',
547 'type' => CRM_Utils_Type::T_INT,
548 'title' => ts('County') ,
549 'description' => 'Which County does this address belong to.',
522a26c9 550 'table_name' => 'civicrm_address',
551 'entity' => 'Address',
552 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 553 'localizable' => 0,
e501603b
TO
554 'FKClassName' => 'CRM_Core_DAO_County',
555 'html' => array(
556 'type' => 'ChainSelect',
557 ) ,
558 'pseudoconstant' => array(
559 'table' => 'civicrm_county',
560 'keyColumn' => 'id',
561 'labelColumn' => 'name',
562 )
563 ) ,
564 'state_province_id' => array(
565 'name' => 'state_province_id',
566 'type' => CRM_Utils_Type::T_INT,
567 'title' => ts('State/Province') ,
568 'description' => 'Which State_Province does this address belong to.',
522a26c9 569 'table_name' => 'civicrm_address',
570 'entity' => 'Address',
571 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 572 'localizable' => 0,
e501603b
TO
573 'FKClassName' => 'CRM_Core_DAO_StateProvince',
574 'html' => array(
575 'type' => 'ChainSelect',
576 ) ,
577 'pseudoconstant' => array(
578 'table' => 'civicrm_state_province',
579 'keyColumn' => 'id',
580 'labelColumn' => 'name',
581 )
582 ) ,
583 'postal_code_suffix' => array(
584 'name' => 'postal_code_suffix',
585 'type' => CRM_Utils_Type::T_STRING,
586 'title' => ts('Postal Code Suffix') ,
587 'description' => 'Store the suffix, like the +4 part in the USPS system.',
588 'maxlength' => 12,
589 'size' => 3,
590 'import' => true,
591 'where' => 'civicrm_address.postal_code_suffix',
592 'headerPattern' => '/p(ostal)\sc(ode)\ss(uffix)/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',
6a7e5e5d 598 'localizable' => 0,
e501603b
TO
599 'html' => array(
600 'type' => 'Text',
601 ) ,
602 ) ,
603 'postal_code' => array(
604 'name' => 'postal_code',
605 'type' => CRM_Utils_Type::T_STRING,
606 'title' => ts('Postal Code') ,
607 'description' => 'Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.',
608 'maxlength' => 64,
609 'size' => 6,
610 'import' => true,
611 'where' => 'civicrm_address.postal_code',
612 'headerPattern' => '/postal|zip/i',
613 'dataPattern' => '/\d?\d{4}(-\d{4})?/',
614 'export' => true,
522a26c9 615 'table_name' => 'civicrm_address',
616 'entity' => 'Address',
617 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 618 'localizable' => 0,
e501603b
TO
619 'html' => array(
620 'type' => 'Text',
621 ) ,
622 ) ,
623 'usps_adc' => array(
624 'name' => 'usps_adc',
625 'type' => CRM_Utils_Type::T_STRING,
626 'title' => ts('USPS Code') ,
627 'description' => 'USPS Bulk mailing code.',
628 'maxlength' => 32,
629 'size' => CRM_Utils_Type::MEDIUM,
522a26c9 630 'table_name' => 'civicrm_address',
631 'entity' => 'Address',
632 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 633 'localizable' => 0,
e501603b
TO
634 ) ,
635 'country_id' => array(
636 'name' => 'country_id',
637 'type' => CRM_Utils_Type::T_INT,
638 'title' => ts('Country') ,
639 'description' => 'Which Country does this address belong to.',
522a26c9 640 'table_name' => 'civicrm_address',
641 'entity' => 'Address',
642 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 643 'localizable' => 0,
e501603b
TO
644 'FKClassName' => 'CRM_Core_DAO_Country',
645 'html' => array(
646 'type' => 'Select',
647 ) ,
648 'pseudoconstant' => array(
649 'table' => 'civicrm_country',
650 'keyColumn' => 'id',
651 'labelColumn' => 'name',
652 'nameColumn' => 'iso_code',
653 )
654 ) ,
655 'geo_code_1' => array(
656 'name' => 'geo_code_1',
657 'type' => CRM_Utils_Type::T_FLOAT,
658 'title' => ts('Latitude') ,
659 'description' => 'Latitude',
660 'import' => true,
661 'where' => 'civicrm_address.geo_code_1',
662 'headerPattern' => '/geo/i',
663 'dataPattern' => '',
664 'export' => true,
522a26c9 665 'table_name' => 'civicrm_address',
666 'entity' => 'Address',
667 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 668 'localizable' => 0,
e501603b
TO
669 'html' => array(
670 'type' => 'Text',
671 ) ,
672 ) ,
673 'geo_code_2' => array(
674 'name' => 'geo_code_2',
675 'type' => CRM_Utils_Type::T_FLOAT,
676 'title' => ts('Longitude') ,
677 'description' => 'Longitude',
678 'import' => true,
679 'where' => 'civicrm_address.geo_code_2',
680 'headerPattern' => '/geo/i',
681 'dataPattern' => '',
682 'export' => true,
522a26c9 683 'table_name' => 'civicrm_address',
684 'entity' => 'Address',
685 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 686 'localizable' => 0,
e501603b
TO
687 'html' => array(
688 'type' => 'Text',
689 ) ,
690 ) ,
691 'manual_geo_code' => array(
692 'name' => 'manual_geo_code',
693 'type' => CRM_Utils_Type::T_BOOLEAN,
694 'title' => ts('Is manually geocoded') ,
695 'description' => 'Is this a manually entered geo code',
522a26c9 696 'table_name' => 'civicrm_address',
697 'entity' => 'Address',
698 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 699 'localizable' => 0,
e501603b
TO
700 'html' => array(
701 'type' => 'CheckBox',
702 ) ,
703 ) ,
704 'timezone' => array(
705 'name' => 'timezone',
706 'type' => CRM_Utils_Type::T_STRING,
707 'title' => ts('Timezone') ,
708 'description' => 'Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".',
709 'maxlength' => 8,
710 'size' => CRM_Utils_Type::EIGHT,
522a26c9 711 'table_name' => 'civicrm_address',
712 'entity' => 'Address',
713 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 714 'localizable' => 0,
e501603b
TO
715 'html' => array(
716 'type' => 'Text',
717 ) ,
718 ) ,
719 'address_name' => array(
720 'name' => 'name',
721 'type' => CRM_Utils_Type::T_STRING,
722 'title' => ts('Address Name') ,
723 'maxlength' => 255,
724 'size' => CRM_Utils_Type::HUGE,
725 'import' => true,
726 'where' => 'civicrm_address.name',
727 'headerPattern' => '/^location|(l(ocation\s)?name)$/i',
728 'dataPattern' => '/^\w+$/',
729 'export' => true,
522a26c9 730 'table_name' => 'civicrm_address',
731 'entity' => 'Address',
732 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 733 'localizable' => 0,
e501603b
TO
734 'html' => array(
735 'type' => 'Text',
736 ) ,
737 ) ,
738 'master_id' => array(
739 'name' => 'master_id',
740 'type' => CRM_Utils_Type::T_INT,
741 'title' => ts('Master Address Belongs To') ,
742 'description' => 'FK to Address ID',
743 'import' => true,
744 'where' => 'civicrm_address.master_id',
745 'headerPattern' => '',
746 'dataPattern' => '',
747 'export' => true,
522a26c9 748 'table_name' => 'civicrm_address',
749 'entity' => 'Address',
750 'bao' => 'CRM_Core_BAO_Address',
6a7e5e5d 751 'localizable' => 0,
e501603b
TO
752 'FKClassName' => 'CRM_Core_DAO_Address',
753 ) ,
754 );
346aaaba 755 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 756 }
346aaaba 757 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
758 }
759 /**
bd8e0b14 760 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
761 *
762 * @return array
bd8e0b14 763 * Array(string $name => string $uniqueName).
e501603b
TO
764 */
765 static function &fieldKeys() {
bd8e0b14
TO
766 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
767 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 768 }
bd8e0b14 769 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
770 }
771 /**
772 * Returns the names of this table
773 *
774 * @return string
775 */
776 static function getTableName() {
777 return self::$_tableName;
778 }
779 /**
780 * Returns if this table needs to be logged
781 *
782 * @return boolean
783 */
784 function getLog() {
785 return self::$_log;
786 }
787 /**
788 * Returns the list of fields that can be imported
789 *
790 * @param bool $prefix
791 *
792 * @return array
793 */
794 static function &import($prefix = false) {
60808919
TO
795 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address', $prefix, array(
796 'CRM_Core_DAO_County',
797 'CRM_Core_DAO_StateProvince',
798 'CRM_Core_DAO_Country',
799 ));
800 return $r;
e501603b
TO
801 }
802 /**
803 * Returns the list of fields that can be exported
804 *
805 * @param bool $prefix
806 *
807 * @return array
808 */
809 static function &export($prefix = false) {
60808919
TO
810 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address', $prefix, array(
811 'CRM_Core_DAO_County',
812 'CRM_Core_DAO_StateProvince',
813 'CRM_Core_DAO_Country',
814 ));
815 return $r;
e501603b
TO
816 }
817}