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