Merge pull request #1046 from colemanw/showHide
[civicrm-core.git] / api / v3 / examples / Activity / ReturnAssigneeContact.php
1 <?php
2
3 /*
4 Function demonstrates getting asignee_contact_id & using it to get the contact
5 */
6 function 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 */
25 function 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 'activity_type_id' => '46',
36 'subject' => 'test activity type id',
37 'activity_date_time' => '2011-06-02 14:36:13',
38 'duration' => '120',
39 'location' => 'Pensulvania',
40 'details' => 'a test activity',
41 'status_id' => '2',
42 'priority_id' => '1',
43 'is_test' => 0,
44 'is_auto' => 0,
45 'is_current_revision' => '1',
46 'is_deleted' => 0,
47 'assignee_contact_id' => array(
48 '0' => '19',
49 ),
50 'source_contact_id' => '17',
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 'current_employer' => '',
87 'address_id' => '',
88 'street_address' => '',
89 'supplemental_address_1' => '',
90 'supplemental_address_2' => '',
91 'city' => '',
92 'postal_code_suffix' => '',
93 'postal_code' => '',
94 'geo_code_1' => '',
95 'geo_code_2' => '',
96 'state_province_id' => '',
97 'state_province_name' => '',
98 'state_province' => '',
99 'country_id' => '',
100 'country' => '',
101 'phone_id' => '',
102 'phone_type_id' => '',
103 'phone' => '',
104 'email_id' => '',
105 'email' => '',
106 'on_hold' => '',
107 'im_id' => '',
108 'provider_id' => '',
109 'im' => '',
110 'worldregion_id' => '',
111 'world_region' => '',
112 'id' => '17',
113 ),
114 ),
115 ),
116 ),
117 ),
118 );
119
120 return $expectedResult ;
121 }
122
123
124 /*
125 * This example has been generated from the API test suite. The test that created it is called
126 *
127 * testActivityGetGoodID1 and can be found in
128 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTest.php
129 *
130 * You can see the outcome of the API tests at
131 * http://tests.dev.civicrm.org/trunk/results-api_v3
132 *
133 * To Learn about the API read
134 * http://book.civicrm.org/developer/current/techniques/api/
135 *
136 * and review the wiki at
137 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
138 *
139 * Read more about testing here
140 * http://wiki.civicrm.org/confluence/display/CRM/Testing
141 *
142 * API Standards documentation:
143 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
144 */