Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | Demonstrate retrieving custom field options | |
5 | */ | |
6 | function contact_getfields_example(){ | |
7a7cc10b | 7 | $params = array( |
8 | 'options' => array( | |
6a488035 TO |
9 | 'get_options' => 'custom_1', |
10 | ), | |
11 | 'version' => 3, | |
12 | 'action' => 'create', | |
13 | ); | |
14 | ||
15 | $result = civicrm_api( 'contact','GetFields',$params ); | |
16 | ||
17 | return $result; | |
18 | } | |
19 | ||
20 | /* | |
21 | * Function returns array of result expected from previous function | |
22 | */ | |
23 | function contact_getfields_expectedresult(){ | |
24 | ||
7a7cc10b | 25 | $expectedResult = array( |
6a488035 TO |
26 | 'is_error' => 0, |
27 | 'version' => 3, | |
7a7cc10b | 28 | 'count' => 53, |
29 | 'values' => array( | |
30 | 'id' => array( | |
6a488035 TO |
31 | 'name' => 'id', |
32 | 'type' => 1, | |
33 | 'title' => 'Internal Contact ID', | |
34 | 'required' => true, | |
35 | 'import' => true, | |
36 | 'where' => 'civicrm_contact.id', | |
37 | 'headerPattern' => '/internal|contact?|id$/i', | |
38 | 'export' => true, | |
7a7cc10b | 39 | 'api.aliases' => array( |
6a488035 TO |
40 | '0' => 'contact_id', |
41 | ), | |
42 | ), | |
7a7cc10b | 43 | 'contact_type' => array( |
6a488035 TO |
44 | 'name' => 'contact_type', |
45 | 'type' => 2, | |
46 | 'title' => 'Contact Type', | |
47 | 'maxlength' => 64, | |
48 | 'size' => 30, | |
49 | 'export' => true, | |
50 | 'where' => 'civicrm_contact.contact_type', | |
7a7cc10b | 51 | 'pseudoconstant' => array( |
52 | 'table' => 'civicrm_contact_type', | |
6a488035 TO |
53 | 'keyColumn' => 'name', |
54 | 'labelColumn' => 'label', | |
7a7cc10b | 55 | 'condition' => 'parent_id IS NULL', |
6a488035 TO |
56 | ), |
57 | 'api.required' => 1, | |
6a488035 | 58 | ), |
7a7cc10b | 59 | 'contact_sub_type' => array( |
6a488035 TO |
60 | 'name' => 'contact_sub_type', |
61 | 'type' => 2, | |
62 | 'title' => 'Contact Subtype', | |
63 | 'maxlength' => 255, | |
64 | 'size' => 45, | |
65 | 'import' => true, | |
66 | 'where' => 'civicrm_contact.contact_sub_type', | |
67 | 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i', | |
68 | 'export' => true, | |
7a7cc10b | 69 | 'pseudoconstant' => array( |
70 | 'table' => 'civicrm_contact_type', | |
71 | 'keyColumn' => 'name', | |
72 | 'labelColumn' => 'label', | |
73 | 'condition' => 'parent_id IS NOT NULL', | |
74 | ), | |
6a488035 | 75 | ), |
7a7cc10b | 76 | 'do_not_email' => array( |
6a488035 TO |
77 | 'name' => 'do_not_email', |
78 | 'type' => 16, | |
79 | 'title' => 'Do Not Email', | |
80 | 'import' => true, | |
81 | 'where' => 'civicrm_contact.do_not_email', | |
82 | 'headerPattern' => '/d(o )?(not )?(email)/i', | |
83 | 'dataPattern' => '/^\d{1,}$/', | |
84 | 'export' => true, | |
85 | ), | |
7a7cc10b | 86 | 'do_not_phone' => array( |
6a488035 TO |
87 | 'name' => 'do_not_phone', |
88 | 'type' => 16, | |
89 | 'title' => 'Do Not Phone', | |
90 | 'import' => true, | |
91 | 'where' => 'civicrm_contact.do_not_phone', | |
92 | 'headerPattern' => '/d(o )?(not )?(call|phone)/i', | |
93 | 'dataPattern' => '/^\d{1,}$/', | |
94 | 'export' => true, | |
95 | ), | |
7a7cc10b | 96 | 'do_not_mail' => array( |
6a488035 TO |
97 | 'name' => 'do_not_mail', |
98 | 'type' => 16, | |
99 | 'title' => 'Do Not Mail', | |
100 | 'import' => true, | |
101 | 'where' => 'civicrm_contact.do_not_mail', | |
102 | 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i', | |
103 | 'dataPattern' => '/^\d{1,}$/', | |
104 | 'export' => true, | |
105 | ), | |
7a7cc10b | 106 | 'do_not_sms' => array( |
6a488035 TO |
107 | 'name' => 'do_not_sms', |
108 | 'type' => 16, | |
109 | 'title' => 'Do Not Sms', | |
110 | 'import' => true, | |
111 | 'where' => 'civicrm_contact.do_not_sms', | |
112 | 'headerPattern' => '/d(o )?(not )?(sms)/i', | |
113 | 'dataPattern' => '/^\d{1,}$/', | |
114 | 'export' => true, | |
115 | ), | |
7a7cc10b | 116 | 'do_not_trade' => array( |
6a488035 TO |
117 | 'name' => 'do_not_trade', |
118 | 'type' => 16, | |
119 | 'title' => 'Do Not Trade', | |
120 | 'import' => true, | |
121 | 'where' => 'civicrm_contact.do_not_trade', | |
122 | 'headerPattern' => '/d(o )?(not )?(trade)/i', | |
123 | 'dataPattern' => '/^\d{1,}$/', | |
124 | 'export' => true, | |
125 | ), | |
7a7cc10b | 126 | 'is_opt_out' => array( |
6a488035 TO |
127 | 'name' => 'is_opt_out', |
128 | 'type' => 16, | |
129 | 'title' => 'No Bulk Emails (User Opt Out)', | |
130 | 'required' => true, | |
131 | 'import' => true, | |
132 | 'where' => 'civicrm_contact.is_opt_out', | |
133 | 'export' => true, | |
134 | ), | |
7a7cc10b | 135 | 'legal_identifier' => array( |
6a488035 TO |
136 | 'name' => 'legal_identifier', |
137 | 'type' => 2, | |
138 | 'title' => 'Legal Identifier', | |
139 | 'maxlength' => 32, | |
140 | 'size' => 20, | |
141 | 'import' => true, | |
142 | 'where' => 'civicrm_contact.legal_identifier', | |
143 | 'headerPattern' => '/legal\s?id/i', | |
144 | 'dataPattern' => '/\w+?\d{5,}/', | |
145 | 'export' => true, | |
146 | ), | |
7a7cc10b | 147 | 'external_identifier' => array( |
6a488035 TO |
148 | 'name' => 'external_identifier', |
149 | 'type' => 2, | |
150 | 'title' => 'External Identifier', | |
151 | 'maxlength' => 32, | |
152 | 'size' => 8, | |
153 | 'import' => true, | |
154 | 'where' => 'civicrm_contact.external_identifier', | |
155 | 'headerPattern' => '/external\s?id/i', | |
156 | 'dataPattern' => '/^\d{11,}$/', | |
157 | 'export' => true, | |
158 | ), | |
7a7cc10b | 159 | 'sort_name' => array( |
6a488035 TO |
160 | 'name' => 'sort_name', |
161 | 'type' => 2, | |
162 | 'title' => 'Sort Name', | |
163 | 'maxlength' => 128, | |
164 | 'size' => 30, | |
165 | 'export' => true, | |
166 | 'where' => 'civicrm_contact.sort_name', | |
167 | ), | |
7a7cc10b | 168 | 'display_name' => array( |
6a488035 TO |
169 | 'name' => 'display_name', |
170 | 'type' => 2, | |
171 | 'title' => 'Display Name', | |
172 | 'maxlength' => 128, | |
173 | 'size' => 30, | |
174 | 'export' => true, | |
175 | 'where' => 'civicrm_contact.display_name', | |
176 | ), | |
7a7cc10b | 177 | 'nick_name' => array( |
6a488035 TO |
178 | 'name' => 'nick_name', |
179 | 'type' => 2, | |
7a7cc10b | 180 | 'title' => 'Nickname', |
6a488035 TO |
181 | 'maxlength' => 128, |
182 | 'size' => 30, | |
183 | 'import' => true, | |
184 | 'where' => 'civicrm_contact.nick_name', | |
185 | 'headerPattern' => '/n(ick\s)name|nick$/i', | |
186 | 'dataPattern' => '/^\w+$/', | |
187 | 'export' => true, | |
188 | ), | |
7a7cc10b | 189 | 'legal_name' => array( |
6a488035 TO |
190 | 'name' => 'legal_name', |
191 | 'type' => 2, | |
192 | 'title' => 'Legal Name', | |
193 | 'maxlength' => 128, | |
194 | 'size' => 30, | |
195 | 'import' => true, | |
196 | 'where' => 'civicrm_contact.legal_name', | |
197 | 'headerPattern' => '/^legal|(l(egal\s)?name)$/i', | |
198 | 'export' => true, | |
199 | ), | |
7a7cc10b | 200 | 'image_URL' => array( |
6a488035 TO |
201 | 'name' => 'image_URL', |
202 | 'type' => 2, | |
203 | 'title' => 'Image Url', | |
204 | 'maxlength' => 255, | |
205 | 'size' => 45, | |
206 | 'import' => true, | |
207 | 'where' => 'civicrm_contact.image_URL', | |
208 | 'export' => true, | |
209 | ), | |
7a7cc10b | 210 | 'preferred_communication_method' => array( |
6a488035 TO |
211 | 'name' => 'preferred_communication_method', |
212 | 'type' => 2, | |
213 | 'title' => 'Preferred Communication Method', | |
214 | 'maxlength' => 255, | |
215 | 'size' => 45, | |
216 | 'import' => true, | |
217 | 'where' => 'civicrm_contact.preferred_communication_method', | |
218 | 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i', | |
219 | 'dataPattern' => '/^\w+$/', | |
220 | 'export' => true, | |
7a7cc10b | 221 | 'pseudoconstant' => array( |
222 | 'optionGroupName' => 'preferred_communication_method', | |
223 | ), | |
6a488035 | 224 | ), |
7a7cc10b | 225 | 'preferred_language' => array( |
6a488035 TO |
226 | 'name' => 'preferred_language', |
227 | 'type' => 2, | |
228 | 'title' => 'Preferred Language', | |
229 | 'maxlength' => 5, | |
230 | 'size' => 6, | |
231 | 'import' => true, | |
232 | 'where' => 'civicrm_contact.preferred_language', | |
233 | 'headerPattern' => '/^lang/i', | |
234 | 'export' => true, | |
7a7cc10b | 235 | 'pseudoconstant' => array( |
236 | 'optionGroupName' => 'languages', | |
237 | 'keyColumn' => 'name', | |
238 | ), | |
6a488035 | 239 | ), |
7a7cc10b | 240 | 'preferred_mail_format' => array( |
6a488035 TO |
241 | 'name' => 'preferred_mail_format', |
242 | 'type' => 2, | |
243 | 'title' => 'Preferred Mail Format', | |
244 | 'import' => true, | |
245 | 'where' => 'civicrm_contact.preferred_mail_format', | |
246 | 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i', | |
247 | 'export' => true, | |
248 | 'default' => 'Both', | |
249 | 'enumValues' => 'Text, HTML, Both', | |
7a7cc10b | 250 | 'options' => array( |
6a488035 TO |
251 | '0' => 'Text', |
252 | '1' => 'HTML', | |
253 | '2' => 'Both', | |
254 | ), | |
255 | ), | |
7a7cc10b | 256 | 'hash' => array( |
6a488035 TO |
257 | 'name' => 'hash', |
258 | 'type' => 2, | |
259 | 'title' => 'Contact Hash', | |
260 | 'maxlength' => 32, | |
261 | 'size' => 20, | |
262 | 'export' => true, | |
263 | 'where' => 'civicrm_contact.hash', | |
264 | ), | |
7a7cc10b | 265 | 'api_key' => array( |
6a488035 TO |
266 | 'name' => 'api_key', |
267 | 'type' => 2, | |
268 | 'title' => 'Api Key', | |
269 | 'maxlength' => 32, | |
270 | 'size' => 20, | |
271 | ), | |
7a7cc10b | 272 | 'first_name' => array( |
6a488035 TO |
273 | 'name' => 'first_name', |
274 | 'type' => 2, | |
275 | 'title' => 'First Name', | |
276 | 'maxlength' => 64, | |
277 | 'size' => 30, | |
278 | 'import' => true, | |
279 | 'where' => 'civicrm_contact.first_name', | |
280 | 'headerPattern' => '/^first|(f(irst\s)?name)$/i', | |
281 | 'dataPattern' => '/^\w+$/', | |
282 | 'export' => true, | |
283 | ), | |
7a7cc10b | 284 | 'middle_name' => array( |
6a488035 TO |
285 | 'name' => 'middle_name', |
286 | 'type' => 2, | |
287 | 'title' => 'Middle Name', | |
288 | 'maxlength' => 64, | |
289 | 'size' => 20, | |
290 | 'import' => true, | |
291 | 'where' => 'civicrm_contact.middle_name', | |
292 | 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i', | |
293 | 'dataPattern' => '/^\w+$/', | |
294 | 'export' => true, | |
295 | ), | |
7a7cc10b | 296 | 'last_name' => array( |
6a488035 TO |
297 | 'name' => 'last_name', |
298 | 'type' => 2, | |
299 | 'title' => 'Last Name', | |
300 | 'maxlength' => 64, | |
301 | 'size' => 30, | |
302 | 'import' => true, | |
303 | 'where' => 'civicrm_contact.last_name', | |
304 | 'headerPattern' => '/^last|(l(ast\s)?name)$/i', | |
305 | 'dataPattern' => '/^\w+(\s\w+)?+$/', | |
306 | 'export' => true, | |
307 | ), | |
7a7cc10b | 308 | 'prefix_id' => array( |
6a488035 TO |
309 | 'name' => 'prefix_id', |
310 | 'type' => 1, | |
311 | 'title' => 'Individual Prefix', | |
7a7cc10b | 312 | 'import' => true, |
313 | 'where' => 'civicrm_contact.prefix_id', | |
314 | 'headerPattern' => '/^(prefix|title)/i', | |
315 | 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i', | |
316 | 'export' => true, | |
317 | 'pseudoconstant' => array( | |
318 | 'optionGroupName' => 'individual_prefix', | |
6a488035 | 319 | ), |
7a7cc10b | 320 | 'api.aliases' => array( |
6a488035 TO |
321 | '0' => 'prefix', |
322 | ), | |
6a488035 | 323 | ), |
7a7cc10b | 324 | 'suffix_id' => array( |
6a488035 TO |
325 | 'name' => 'suffix_id', |
326 | 'type' => 1, | |
327 | 'title' => 'Individual Suffix', | |
7a7cc10b | 328 | 'import' => true, |
329 | 'where' => 'civicrm_contact.suffix_id', | |
330 | 'headerPattern' => '/^suffix$/i', | |
331 | 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/', | |
332 | 'export' => true, | |
333 | 'pseudoconstant' => array( | |
334 | 'optionGroupName' => 'individual_suffix', | |
6a488035 | 335 | ), |
7a7cc10b | 336 | 'api.aliases' => array( |
6a488035 TO |
337 | '0' => 'suffix', |
338 | ), | |
6a488035 | 339 | ), |
7a7cc10b | 340 | 'email_greeting_id' => array( |
6a488035 TO |
341 | 'name' => 'email_greeting_id', |
342 | 'type' => 1, | |
343 | 'title' => 'Email Greeting ID', | |
344 | ), | |
7a7cc10b | 345 | 'email_greeting_custom' => array( |
6a488035 TO |
346 | 'name' => 'email_greeting_custom', |
347 | 'type' => 2, | |
348 | 'title' => 'Email Greeting Custom', | |
349 | 'maxlength' => 128, | |
350 | 'size' => 45, | |
351 | 'import' => true, | |
352 | 'where' => 'civicrm_contact.email_greeting_custom', | |
353 | ), | |
7a7cc10b | 354 | 'email_greeting_display' => array( |
6a488035 TO |
355 | 'name' => 'email_greeting_display', |
356 | 'type' => 2, | |
357 | 'title' => 'Email Greeting', | |
358 | 'maxlength' => 255, | |
359 | 'size' => 45, | |
360 | ), | |
7a7cc10b | 361 | 'postal_greeting_id' => array( |
6a488035 TO |
362 | 'name' => 'postal_greeting_id', |
363 | 'type' => 1, | |
364 | 'title' => 'Postal Greeting ID', | |
365 | ), | |
7a7cc10b | 366 | 'postal_greeting_custom' => array( |
6a488035 TO |
367 | 'name' => 'postal_greeting_custom', |
368 | 'type' => 2, | |
369 | 'title' => 'Postal Greeting Custom', | |
370 | 'maxlength' => 128, | |
371 | 'size' => 45, | |
372 | 'import' => true, | |
373 | 'where' => 'civicrm_contact.postal_greeting_custom', | |
374 | ), | |
7a7cc10b | 375 | 'postal_greeting_display' => array( |
6a488035 TO |
376 | 'name' => 'postal_greeting_display', |
377 | 'type' => 2, | |
378 | 'title' => 'Postal Greeting', | |
379 | 'maxlength' => 255, | |
380 | 'size' => 45, | |
381 | ), | |
7a7cc10b | 382 | 'addressee_id' => array( |
6a488035 TO |
383 | 'name' => 'addressee_id', |
384 | 'type' => 1, | |
385 | 'title' => 'Addressee ID', | |
386 | ), | |
7a7cc10b | 387 | 'addressee_custom' => array( |
6a488035 TO |
388 | 'name' => 'addressee_custom', |
389 | 'type' => 2, | |
390 | 'title' => 'Addressee Custom', | |
391 | 'maxlength' => 128, | |
392 | 'size' => 45, | |
393 | 'import' => true, | |
394 | 'where' => 'civicrm_contact.addressee_custom', | |
395 | ), | |
7a7cc10b | 396 | 'addressee_display' => array( |
6a488035 TO |
397 | 'name' => 'addressee_display', |
398 | 'type' => 2, | |
399 | 'title' => 'Addressee', | |
400 | 'maxlength' => 255, | |
401 | 'size' => 45, | |
402 | ), | |
7a7cc10b | 403 | 'job_title' => array( |
6a488035 TO |
404 | 'name' => 'job_title', |
405 | 'type' => 2, | |
406 | 'title' => 'Job Title', | |
407 | 'maxlength' => 255, | |
408 | 'size' => 20, | |
409 | 'import' => true, | |
410 | 'where' => 'civicrm_contact.job_title', | |
411 | 'headerPattern' => '/^job|(j(ob\s)?title)$/i', | |
412 | 'dataPattern' => '//', | |
413 | 'export' => true, | |
414 | ), | |
7a7cc10b | 415 | 'gender_id' => array( |
6a488035 TO |
416 | 'name' => 'gender_id', |
417 | 'type' => 1, | |
418 | 'title' => 'Gender', | |
7a7cc10b | 419 | 'import' => true, |
420 | 'where' => 'civicrm_contact.gender_id', | |
421 | 'headerPattern' => '/^gender$/i', | |
422 | 'export' => true, | |
423 | 'pseudoconstant' => array( | |
6a488035 TO |
424 | 'optionGroupName' => 'gender', |
425 | ), | |
7a7cc10b | 426 | 'api.aliases' => array( |
6a488035 TO |
427 | '0' => 'gender', |
428 | ), | |
6a488035 | 429 | ), |
7a7cc10b | 430 | 'birth_date' => array( |
6a488035 TO |
431 | 'name' => 'birth_date', |
432 | 'type' => 4, | |
433 | 'title' => 'Birth Date', | |
434 | 'import' => true, | |
435 | 'where' => 'civicrm_contact.birth_date', | |
436 | 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i', | |
437 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
438 | 'export' => true, | |
439 | ), | |
7a7cc10b | 440 | 'is_deceased' => array( |
6a488035 TO |
441 | 'name' => 'is_deceased', |
442 | 'type' => 16, | |
443 | 'title' => 'Is Deceased', | |
444 | 'import' => true, | |
445 | 'where' => 'civicrm_contact.is_deceased', | |
446 | 'headerPattern' => '/i(s\s)?d(eceased)$/i', | |
447 | 'export' => true, | |
448 | ), | |
7a7cc10b | 449 | 'deceased_date' => array( |
6a488035 TO |
450 | 'name' => 'deceased_date', |
451 | 'type' => 4, | |
452 | 'title' => 'Deceased Date', | |
453 | 'import' => true, | |
454 | 'where' => 'civicrm_contact.deceased_date', | |
455 | 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i', | |
456 | 'export' => true, | |
457 | ), | |
7a7cc10b | 458 | 'household_name' => array( |
6a488035 TO |
459 | 'name' => 'household_name', |
460 | 'type' => 2, | |
461 | 'title' => 'Household Name', | |
462 | 'maxlength' => 128, | |
463 | 'size' => 30, | |
464 | 'import' => true, | |
465 | 'where' => 'civicrm_contact.household_name', | |
466 | 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i', | |
467 | 'dataPattern' => '/^\w+$/', | |
468 | 'export' => true, | |
469 | ), | |
7a7cc10b | 470 | 'primary_contact_id' => array( |
6a488035 TO |
471 | 'name' => 'primary_contact_id', |
472 | 'type' => 1, | |
473 | 'title' => 'Household Primary Contact ID', | |
474 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
475 | ), | |
7a7cc10b | 476 | 'organization_name' => array( |
6a488035 TO |
477 | 'name' => 'organization_name', |
478 | 'type' => 2, | |
479 | 'title' => 'Organization Name', | |
480 | 'maxlength' => 128, | |
481 | 'size' => 30, | |
482 | 'import' => true, | |
483 | 'where' => 'civicrm_contact.organization_name', | |
484 | 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i', | |
485 | 'dataPattern' => '/^\w+$/', | |
486 | 'export' => true, | |
487 | ), | |
7a7cc10b | 488 | 'sic_code' => array( |
6a488035 TO |
489 | 'name' => 'sic_code', |
490 | 'type' => 2, | |
491 | 'title' => 'Sic Code', | |
492 | 'maxlength' => 8, | |
493 | 'size' => 8, | |
494 | 'import' => true, | |
495 | 'where' => 'civicrm_contact.sic_code', | |
496 | 'headerPattern' => '/^sic|(s(ic\s)?code)$/i', | |
497 | 'export' => true, | |
498 | ), | |
7a7cc10b | 499 | 'user_unique_id' => array( |
6a488035 TO |
500 | 'name' => 'user_unique_id', |
501 | 'type' => 2, | |
502 | 'title' => 'Unique ID (OpenID)', | |
503 | 'maxlength' => 255, | |
504 | 'size' => 45, | |
505 | 'import' => true, | |
506 | 'where' => 'civicrm_contact.user_unique_id', | |
507 | 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i', | |
508 | 'dataPattern' => '/^[\w\/\:\.]+$/', | |
509 | 'export' => true, | |
510 | 'rule' => 'url', | |
511 | ), | |
7a7cc10b | 512 | 'created_date' => array( |
6a488035 TO |
513 | 'name' => 'created_date', |
514 | 'type' => 256, | |
515 | 'title' => 'Created Date', | |
516 | 'required' => '', | |
517 | 'default' => 'UL', | |
518 | ), | |
7a7cc10b | 519 | 'modified_date' => array( |
6a488035 TO |
520 | 'name' => 'modified_date', |
521 | 'type' => 256, | |
522 | 'title' => 'Modified Date', | |
523 | 'required' => '', | |
524 | 'default' => 'URRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAM', | |
525 | ), | |
7a7cc10b | 526 | 'source' => array( |
6a488035 TO |
527 | 'name' => 'source', |
528 | 'type' => 2, | |
529 | 'title' => 'Source of Contact Data', | |
530 | 'maxlength' => 255, | |
531 | 'size' => 30, | |
532 | 'import' => true, | |
533 | 'where' => 'civicrm_contact.source', | |
534 | 'headerPattern' => '/(S(ource\s)?o(f\s)?C(ontact\s)?Data)$/i', | |
535 | 'export' => true, | |
536 | 'uniqueName' => 'contact_source', | |
537 | ), | |
7a7cc10b | 538 | 'employer_id' => array( |
6a488035 TO |
539 | 'name' => 'employer_id', |
540 | 'type' => 1, | |
541 | 'title' => 'Current Employer ID', | |
542 | 'export' => true, | |
543 | 'where' => 'civicrm_contact.employer_id', | |
544 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
545 | 'uniqueName' => 'current_employer_id', | |
546 | ), | |
7a7cc10b | 547 | 'is_deleted' => array( |
6a488035 TO |
548 | 'name' => 'is_deleted', |
549 | 'type' => 16, | |
550 | 'title' => 'Contact is in Trash', | |
551 | 'required' => true, | |
552 | 'export' => true, | |
553 | 'where' => 'civicrm_contact.is_deleted', | |
554 | 'uniqueName' => 'contact_is_deleted', | |
555 | ), | |
7a7cc10b | 556 | 'custom_1' => array( |
7f6d3dd3 | 557 | 'label' => 'Our special field', |
6a488035 TO |
558 | 'groupTitle' => 'select_test_g', |
559 | 'data_type' => 'String', | |
560 | 'html_type' => 'Select', | |
561 | 'text_length' => '', | |
562 | 'options_per_line' => '', | |
563 | 'custom_group_id' => '1', | |
564 | 'extends' => 'Contact', | |
565 | 'is_search_range' => 0, | |
566 | 'extends_entity_column_value' => '', | |
567 | 'extends_entity_column_id' => '', | |
568 | 'is_view' => 0, | |
569 | 'is_multiple' => 0, | |
7a7cc10b | 570 | 'option_group_id' => '97', |
6a488035 TO |
571 | 'date_format' => '', |
572 | 'time_format' => '', | |
7a7cc10b | 573 | 'options' => array( |
6a488035 TO |
574 | '1' => 'Label1', |
575 | '2' => 'Label2', | |
576 | ), | |
577 | ), | |
7a7cc10b | 578 | 'current_employer' => array( |
6a488035 TO |
579 | 'title' => 'Current Employer', |
580 | 'description' => 'Name of Current Employer', | |
581 | ), | |
7a7cc10b | 582 | 'dupe_check' => array( |
583 | 'title' => 'Check for Duplicates', | |
584 | 'description' => 'Throw error if contact create matches dedupe rule', | |
585 | ), | |
6a488035 TO |
586 | ), |
587 | ); | |
588 | ||
589 | return $expectedResult ; | |
590 | } | |
591 | ||
592 | ||
593 | /* | |
594 | * This example has been generated from the API test suite. The test that created it is called | |
595 | * | |
596 | * testCustomFieldCreateWithOptionValues and can be found in | |
597 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php | |
598 | * | |
599 | * You can see the outcome of the API tests at | |
600 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
601 | * | |
602 | * To Learn about the API read | |
603 | * http://book.civicrm.org/developer/current/techniques/api/ | |
604 | * | |
605 | * and review the wiki at | |
606 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
607 | * | |
608 | * Read more about testing here | |
609 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
610 | * | |
611 | * API Standards documentation: | |
612 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
613 | */ |