Import from SVN (r45945, r596)
[civicrm-core.git] / api / v3 / examples / Activity / ReturnAssigneeContact.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 Function demonstrates getting asignee_contact_id & using it to get the contact
5 */
6function activity_get_example(){
7$params = array(
8 'activity_id' => 1,
9 'version' => 3,
10 'sequential' => 1,
11 'return.assignee_contact_id' => 1,
12 'api.contact.get' => array(
13 'id' => '$value.source_contact_id',
14 ),
15);
16
17 $result = civicrm_api( 'activity','get',$params );
18
19 return $result;
20}
21
22/*
23 * Function returns array of result expected from previous function
24 */
25function activity_get_expectedresult(){
26
27 $expectedResult = array(
28 'is_error' => 0,
29 'version' => 3,
30 'count' => 1,
31 'id' => 1,
32 'values' => array(
33 '0' => array(
34 'id' => '1',
35 'source_contact_id' => '17',
36 'activity_type_id' => '44',
37 'subject' => 'test activity type id',
38 'activity_date_time' => '2011-06-02 14:36:13',
39 'duration' => '120',
40 'location' => 'Pensulvania',
41 'details' => 'a test activity',
42 'status_id' => '2',
43 'priority_id' => '1',
44 'is_test' => 0,
45 'is_auto' => 0,
46 'is_current_revision' => '1',
47 'is_deleted' => 0,
48 'assignee_contact_id' => array(
49 '0' => '19',
50 ),
51 'api.contact.get' => array(
52 'is_error' => 0,
53 'version' => 3,
54 'count' => 1,
55 'id' => 17,
56 'values' => array(
57 '0' => array(
58 'contact_id' => '17',
59 'contact_type' => 'Individual',
60 'contact_sub_type' => '',
61 'sort_name' => '',
62 'display_name' => 'Test Contact',
63 'do_not_email' => '',
64 'do_not_phone' => '',
65 'do_not_mail' => '',
66 'do_not_sms' => '',
67 'do_not_trade' => '',
68 'is_opt_out' => 0,
69 'legal_identifier' => '',
70 'external_identifier' => '',
71 'nick_name' => '',
72 'legal_name' => '',
73 'image_URL' => '',
74 'preferred_mail_format' => '',
75 'first_name' => 'Test',
76 'middle_name' => '',
77 'last_name' => 'Contact',
78 'job_title' => '',
79 'birth_date' => '',
80 'is_deceased' => 0,
81 'deceased_date' => '',
82 'household_name' => '',
83 'organization_name' => '',
84 'sic_code' => '',
85 'contact_is_deleted' => 0,
86 'gender_id' => '',
87 'gender' => '',
88 'prefix_id' => '',
89 'prefix' => '',
90 'suffix_id' => '',
91 'suffix' => '',
92 'current_employer' => '',
93 'address_id' => '',
94 'street_address' => '',
95 'supplemental_address_1' => '',
96 'supplemental_address_2' => '',
97 'city' => '',
98 'postal_code_suffix' => '',
99 'postal_code' => '',
100 'geo_code_1' => '',
101 'geo_code_2' => '',
102 'state_province_id' => '',
103 'state_province_name' => '',
104 'state_province' => '',
105 'country_id' => '',
106 'country' => '',
107 'phone_id' => '',
108 'phone_type_id' => '',
109 'phone' => '',
110 'email_id' => '',
111 'email' => '',
112 'on_hold' => '',
113 'im_id' => '',
114 'provider_id' => '',
115 'im' => '',
116 'worldregion_id' => '',
117 'world_region' => '',
118 'id' => '17',
119 ),
120 ),
121 ),
122 ),
123 ),
124);
125
126 return $expectedResult ;
127}
128
129
130/*
131* This example has been generated from the API test suite. The test that created it is called
132*
133* testActivityGetGoodID1 and can be found in
134* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTest.php
135*
136* You can see the outcome of the API tests at
137* http://tests.dev.civicrm.org/trunk/results-api_v3
138*
139* To Learn about the API read
140* http://book.civicrm.org/developer/current/techniques/api/
141*
142* and review the wiki at
143* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
144*
145* Read more about testing here
146* http://wiki.civicrm.org/confluence/display/CRM/Testing
147*
148* API Standards documentation:
149* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
150*/