Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06a1bc01 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 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 along with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
6a488035 | 27 | require_once 'WebTest/Export/ExportCiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Export_ContactTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
e0bbb596 AS |
38 | function testPrefixGenderSuffix(){ |
39 | $this->webtestLogin(); | |
40 | ||
41 | // Create new group | |
42 | $parentGroupName = 'TestSuffixPrefixGender_' . substr(sha1(rand()), 0, 7); | |
43 | $this->addContactGroup($parentGroupName); | |
44 | ||
45 | // Adding Parent group contact | |
46 | // We're using Quick Add block on the main page for this. | |
47 | $firstContactName = 'TestExport' . substr(sha1(rand()), 0, 7); | |
542e6ea1 AS |
48 | |
49 | list($emailContactFirst,$prefixLabelContactFrst,$suffixLabelContactFrst,$genderLabelContactFrst) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($firstContactName, "Smith", "$firstContactName.smith@example.org", Null); | |
e0bbb596 AS |
50 | |
51 | $sortFirstName = "Smith, $firstContactName"; | |
52 | $displayFirstName = "$firstContactName Smith"; | |
53 | ||
54 | // Add contact to parent group | |
55 | // visit group tab. | |
56 | $this->click("css=li#tab_group a"); | |
57 | $this->waitForElementPresent("group_id"); | |
58 | ||
59 | // Add to group. | |
60 | $this->select("group_id", "label=$parentGroupName"); | |
61 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 62 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
e0bbb596 | 63 | |
e0bbb596 | 64 | $secondContactName = 'TestExport2' . substr(sha1(rand()), 0, 7); |
542e6ea1 | 65 | list($emailContactSecond,$prefixLabelContactScnd,$suffixLabelContactScnd,$genderLabelContactScnd) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($secondContactName, "John", "$secondContactName.john@example.org", Null); |
e0bbb596 AS |
66 | |
67 | $sortSecondName = "John, $secondContactName"; | |
68 | $displaySecondName = "$secondContactName John"; | |
69 | ||
70 | // Add contact to parent group | |
71 | // visit group tab. | |
72 | $this->click("css=li#tab_group a"); | |
73 | $this->waitForElementPresent("group_id"); | |
74 | ||
75 | // Add to group. | |
76 | $this->select("group_id", "label=$parentGroupName"); | |
77 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 78 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
e0bbb596 AS |
79 | |
80 | $this->openCiviPage("contact/search", "reset=1"); | |
81 | ||
82 | // Select contact type as Indiividual. | |
83 | $this->select("contact_type", "value=Individual"); | |
84 | ||
85 | // Select group. | |
86 | $this->select("group", "label=$parentGroupName"); | |
87 | ||
88 | // Click to search. | |
89 | $this->click("_qf_Basic_refresh"); | |
90 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
91 | ||
92 | // Is contact present in search result? | |
93 | $this->assertElementContainsText('css=div.crm-search-results', $sortFirstName, "Contact did not found in search result!"); | |
94 | ||
95 | // Is contact present in search result? | |
96 | $this->assertElementContainsText('css=div.crm-search-results', $sortSecondName, "Contact did not found in search result!"); | |
97 | ||
98 | // select to export all the contasct from search result. | |
99 | $this->click("CIVICRM_QFID_ts_all_4"); | |
100 | ||
101 | // Select the task action to export. | |
102 | $this->click("task"); | |
103 | $this->select("task", "label=Export Contacts"); | |
104 | $this->click("Go"); | |
105 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
106 | ||
107 | $csvFile = $this->downloadCSV("_qf_Select_next-bottom"); | |
108 | ||
109 | // Build header row for assertion. | |
110 | require_once 'CRM/Contact/BAO/Contact.php'; | |
111 | $expotableFields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE); | |
112 | ||
113 | $checkHeaders = array(); | |
114 | foreach ($expotableFields as $key => $field) { | |
115 | // Exclude custom fields. | |
116 | if ($key && (substr($key, 0, 6) == 'custom')) { | |
117 | continue; | |
118 | } | |
119 | $checkHeaders[] = $field['title']; | |
120 | } | |
121 | ||
122 | // All other rows to be check. | |
123 | $checkRows = array( | |
124 | 1 => array( | |
125 | 'First Name' => $firstContactName, | |
126 | 'Last Name' => 'Smith', | |
542e6ea1 | 127 | 'Email' => ''.strtolower($emailContactFirst).'', |
e0bbb596 | 128 | 'Sort Name' => $sortFirstName, |
542e6ea1 AS |
129 | 'Display Name' => $prefixLabelContactFrst.' '.$displayFirstName.' '.$suffixLabelContactFrst, |
130 | 'Individual Prefix' => $prefixLabelContactFrst, | |
131 | 'Individual Suffix' => $suffixLabelContactFrst, | |
132 | 'Gender' => $genderLabelContactFrst, | |
e0bbb596 AS |
133 | ), |
134 | 2 => array( | |
135 | 'First Name' => $secondContactName, | |
136 | 'Last Name' => 'John', | |
542e6ea1 | 137 | 'Email' => ''.strtolower($emailContactSecond).'', |
e0bbb596 | 138 | 'Sort Name' => $sortSecondName, |
542e6ea1 AS |
139 | 'Display Name' => $prefixLabelContactScnd.' '.$displaySecondName.' '.$suffixLabelContactScnd, |
140 | 'Individual Prefix' => $prefixLabelContactScnd, | |
141 | 'Individual Suffix' => $suffixLabelContactScnd, | |
142 | 'Gender' => $genderLabelContactScnd, | |
e0bbb596 AS |
143 | ), |
144 | ); | |
145 | ||
146 | // Read CSV and fire assertions. | |
147 | $this->reviewCSV($csvFile, $checkHeaders, $checkRows, 2); | |
148 | } | |
149 | ||
6a488035 TO |
150 | /** |
151 | * Test Contact Export. | |
152 | */ | |
153 | function testContactExport() { | |
6a488035 TO |
154 | $this->webtestLogin(); |
155 | ||
156 | // Create new group | |
157 | $parentGroupName = 'Parentgroup_' . substr(sha1(rand()), 0, 7); | |
158 | $this->addContactGroup($parentGroupName); | |
159 | ||
160 | // Create new group and select the previously selected group as parent group for this new group. | |
161 | $childGroupName = 'Childgroup_' . substr(sha1(rand()), 0, 7); | |
162 | $this->addContactGroup($childGroupName, $parentGroupName); | |
163 | ||
164 | // Adding Parent group contact | |
165 | // We're using Quick Add block on the main page for this. | |
166 | $firstName = 'a' . substr(sha1(rand()), 0, 7); | |
167 | $this->webtestAddContact($firstName, "Smith", "$firstName.smith@example.org"); | |
168 | ||
169 | $sortName = "Smith, $firstName"; | |
170 | $displayName = "$firstName Smith"; | |
171 | ||
172 | // Add contact to parent group | |
173 | // visit group tab. | |
174 | $this->click("css=li#tab_group a"); | |
175 | $this->waitForElementPresent("group_id"); | |
176 | ||
177 | // Add to group. | |
178 | $this->select("group_id", "label=$parentGroupName"); | |
179 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 180 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
6a488035 TO |
181 | |
182 | // Adding child group contact | |
183 | // We're using Quick Add block on the main page for this. | |
184 | $childName = 'b' . substr(sha1(rand()), 0, 7); | |
185 | $this->webtestAddContact($childName, "John", "$childName.john@example.org"); | |
186 | ||
187 | $childSortName = "John, $childName"; | |
188 | $childDisplayName = "$childName John"; | |
189 | ||
190 | // Add contact to child group | |
191 | // visit group tab. | |
192 | $this->click("css=li#tab_group a"); | |
193 | $this->waitForElementPresent("group_id"); | |
194 | ||
195 | // Add to child group. | |
196 | $this->select("group_id", "label=regexp:$childGroupName"); | |
197 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 198 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
6a488035 TO |
199 | |
200 | // Visit contact search page. | |
cb5b38f1 | 201 | $this->openCiviPage("contact/search", "reset=1"); |
6a488035 TO |
202 | |
203 | // Select contact type as Indiividual. | |
204 | $this->select("contact_type", "value=Individual"); | |
205 | ||
206 | // Select group. | |
207 | $this->select("group", "label=$parentGroupName"); | |
208 | ||
209 | // Click to search. | |
210 | $this->click("_qf_Basic_refresh"); | |
211 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
212 | ||
213 | // Is contact present in search result? | |
a5a7f3f2 | 214 | $this->assertElementContainsText('css=div.crm-search-results', $sortName, "Contact did not found in search result!"); |
76e86fd8 | 215 | |
6a488035 | 216 | // Is contact present in search result? |
a5a7f3f2 | 217 | $this->assertElementContainsText('css=div.crm-search-results', $childSortName, "Contact did not found in search result!"); |
76e86fd8 | 218 | |
6a488035 TO |
219 | // select to export all the contasct from search result. |
220 | $this->click("CIVICRM_QFID_ts_all_4"); | |
221 | ||
222 | // Select the task action to export. | |
223 | $this->click("task"); | |
224 | $this->select("task", "label=Export Contacts"); | |
225 | $this->click("Go"); | |
226 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
227 | ||
228 | $csvFile = $this->downloadCSV("_qf_Select_next-bottom"); | |
229 | ||
230 | // Build header row for assertion. | |
231 | require_once 'CRM/Contact/BAO/Contact.php'; | |
232 | $expotableFields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE); | |
233 | ||
234 | $checkHeaders = array(); | |
235 | foreach ($expotableFields as $key => $field) { | |
236 | // Exclude custom fields. | |
237 | if ($key && (substr($key, 0, 6) == 'custom')) { | |
238 | continue; | |
239 | } | |
240 | $checkHeaders[] = $field['title']; | |
241 | } | |
242 | ||
243 | // All other rows to be check. | |
244 | $checkRows = array( | |
245 | 1 => array( | |
246 | 'First Name' => $firstName, | |
247 | 'Last Name' => 'Smith', | |
248 | 'Email' => "$firstName.smith@example.org", | |
249 | 'Sort Name' => $sortName, | |
250 | 'Display Name' => $displayName, | |
251 | ), | |
252 | 2 => array( | |
253 | 'First Name' => $childName, | |
254 | 'Last Name' => 'John', | |
255 | 'Email' => "$childName.john@example.org", | |
256 | 'Sort Name' => $childSortName, | |
257 | 'Display Name' => $childDisplayName, | |
258 | ), | |
259 | ); | |
260 | ||
261 | // Read CSV and fire assertions. | |
262 | $this->reviewCSV($csvFile, $checkHeaders, $checkRows, 2); | |
263 | } | |
264 | ||
265 | function testMergeHousehold() { | |
6a488035 TO |
266 | $this->webtestLogin(); |
267 | ||
268 | // Create new group | |
269 | $groupName = 'TestGroup_' . substr(sha1(rand()), 0, 7); | |
270 | $this->addContactGroup($groupName); | |
271 | ||
272 | // Adding Parent group contact | |
273 | // We're using Quick Add block on the main page for this. | |
274 | $houseHold = 'H' . substr(sha1(rand()), 0, 5) . ' House'; | |
275 | ||
cb5b38f1 | 276 | $this->openCiviPage("contact/add", "reset=1&ct=Household"); |
6a488035 TO |
277 | $this->click('household_name'); |
278 | $this->type('household_name', $houseHold); | |
279 | ||
280 | //address section | |
281 | $this->click("addressBlock"); | |
282 | $this->waitForElementPresent("address_1_street_address"); | |
283 | ||
284 | // fill in address | |
285 | $this->click("//div[@id='addressBlockId']/div[1]"); | |
286 | $this->type("address_1_street_address", "121A Sherman St. Apt. 12"); | |
287 | $this->type("address_1_city", "Dumfries"); | |
288 | $this->type("address_1_postal_code", "1234"); | |
a5a7f3f2 | 289 | $this->assertElementContainsText('address_1', "- select - United States"); |
6a488035 TO |
290 | $this->select("address_1_state_province_id", "value=1019"); |
291 | ||
292 | $this->click('_qf_Contact_upload_view'); | |
293 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
294 | ||
295 | // Add contact to group | |
296 | // visit group tab. | |
297 | $this->click("css=li#tab_group a"); | |
298 | $this->waitForElementPresent("group_id"); | |
299 | ||
300 | // Add to group. | |
301 | $this->select("group_id", "label=$groupName"); | |
302 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 303 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
6a488035 | 304 | |
6a488035 TO |
305 | $firstName1 = 'aa' . substr(sha1(rand()), 0, 5); |
306 | $this->webtestAddContact($firstName1, "Smith", "{$firstName1}.smith@example.org"); | |
307 | ||
308 | $sortName1 = "Smith, {$firstName1}"; | |
309 | $displayName1 = "{$firstName1} Smith"; | |
310 | ||
311 | // Add contact to parent group | |
312 | // visit group tab. | |
313 | $this->click("css=li#tab_group a"); | |
314 | $this->waitForElementPresent("group_id"); | |
315 | ||
316 | // Add to group. | |
317 | $this->select("group_id", "label=$groupName"); | |
318 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 319 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
6a488035 TO |
320 | |
321 | $firstName2 = 'bb' . substr(sha1(rand()), 0, 5); | |
322 | ||
cb5b38f1 | 323 | $this->openCiviPage("contact/add", "reset=1&ct=Individual", "_qf_Contact_upload_view-bottom"); |
6a488035 TO |
324 | $this->type('first_name', $firstName2); |
325 | $this->type('last_name', "Smith"); | |
326 | $this->type('email_1_email', "{$firstName2}.smith@example.org"); | |
327 | ||
328 | //address section | |
329 | $this->click("addressBlock"); | |
330 | $this->waitForElementPresent("address_1_street_address"); | |
331 | ||
332 | $this->click("//div[@id='addressBlockId']/div[1]"); | |
333 | ||
334 | $this->click("address[1][use_shared_address]"); | |
45fabf8e | 335 | $this->waitForElementPresent("address_1_master_contact_id"); |
336 | $this->select2('address_1_master_contact_id', $houseHold); | |
6a488035 TO |
337 | $this->waitForTextPresent("121A Sherman"); |
338 | ||
339 | $this->click('_qf_Contact_upload_view-bottom'); | |
340 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
341 | ||
342 | $sortName2 = "Smith, {$firstName2}"; | |
343 | $displayName2 = "{$firstName2} Smith"; | |
344 | ||
345 | // Add contact to parent group | |
346 | // visit group tab. | |
347 | $this->click("css=li#tab_group a"); | |
348 | $this->waitForElementPresent("group_id"); | |
349 | ||
350 | // Add to group. | |
351 | $this->select("group_id", "label=$groupName"); | |
352 | $this->click("_qf_GroupContact_next"); | |
45fabf8e | 353 | $this->waitForElementPresent("//*[@id='GroupContact']"); |
6a488035 | 354 | |
60879f50 | 355 | $this->openCiviPage("contact/search", "reset=1", NULL); |
6a488035 TO |
356 | |
357 | // Select group. | |
358 | $this->select("group", "label=$groupName"); | |
359 | ||
360 | // Click to search. | |
361 | $this->click("_qf_Basic_refresh"); | |
362 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
363 | ||
364 | // Is contact present in search result? | |
a5a7f3f2 | 365 | $this->assertElementContainsText('css=div.crm-search-results', $sortName1, "Contact did not found in search result!"); |
76e86fd8 | 366 | |
6a488035 | 367 | // Is contact present in search result? |
a5a7f3f2 | 368 | $this->assertElementContainsText('css=div.crm-search-results', $sortName2, "Contact did not found in search result!"); |
76e86fd8 | 369 | |
6a488035 | 370 | // Is contact present in search result? |
a5a7f3f2 | 371 | $this->assertElementContainsText('css=div.crm-search-results', $houseHold, "Contact did not found in search result!"); |
76e86fd8 | 372 | |
6a488035 TO |
373 | // select to export all the contasct from search result. |
374 | $this->click("CIVICRM_QFID_ts_all_4"); | |
375 | ||
376 | // Select the task action to export. | |
377 | $this->click("task"); | |
378 | $this->select("task", "label=Export Contacts"); | |
379 | $this->click("Go"); | |
380 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
381 | ||
382 | $this->click("CIVICRM_QFID_2_10"); | |
383 | ||
384 | $csvFile = $this->downloadCSV("_qf_Select_next-bottom"); | |
385 | ||
386 | // Build header row for assertion. | |
387 | require_once 'CRM/Contact/BAO/Contact.php'; | |
388 | $expotableFields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE); | |
389 | ||
390 | $checkHeaders = array(); | |
391 | foreach ($expotableFields as $key => $field) { | |
392 | // Exclude custom fields. | |
393 | if ($key && (substr($key, 0, 6) == 'custom')) { | |
394 | continue; | |
395 | } | |
396 | $checkHeaders[] = $field['title']; | |
397 | } | |
398 | ||
399 | // All other rows to be check. | |
400 | $checkRows = array( | |
401 | 1 => array( | |
402 | 'Contact Type' => 'Household', | |
403 | 'Household Name' => $houseHold, | |
404 | ), | |
405 | 2 => array( | |
406 | 'Contact Type' => 'Individual', | |
407 | 'First Name' => $firstName1, | |
408 | 'Email' => "{$firstName1}.smith@example.org", | |
409 | 'Sort Name' => $sortName1, | |
410 | 'Display Name' => $displayName1, | |
411 | ), | |
412 | ); | |
413 | ||
414 | // Read CSV and fire assertions. | |
415 | $this->reviewCSV($csvFile, $checkHeaders, $checkRows, 2); | |
416 | } | |
417 | ||
4cbe18b8 EM |
418 | /** |
419 | * @param string $groupName | |
420 | * @param string $parentGroupName | |
421 | */ | |
45fabf8e | 422 | function addContactGroup($groupName = 'New Group', $parentGroupName = "- select group -") { |
cb5b38f1 | 423 | $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload"); |
6a488035 TO |
424 | |
425 | // Fill group name. | |
426 | $this->type("title", $groupName); | |
427 | ||
428 | // Fill description. | |
429 | $this->type("description", "Adding new group."); | |
430 | ||
431 | // Check Access Control. | |
432 | $this->click("group_type[1]"); | |
433 | ||
434 | // Check Mailing List. | |
435 | $this->click("group_type[2]"); | |
436 | ||
437 | // Select Visibility as Public Pages. | |
438 | $this->select("visibility", "value=Public Pages"); | |
439 | ||
440 | // Select parent group. | |
441 | $this->select("parents", "label=$parentGroupName"); | |
442 | ||
443 | // Clicking save. | |
444 | $this->click("_qf_Edit_upload"); | |
445 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
446 | ||
447 | // Is status message correct? | |
6c5f7368 | 448 | $this->waitForText('crm-notification-container', "The Group '$groupName' has been saved."); |
6a488035 | 449 | } |
e0bbb596 | 450 | |
4cbe18b8 EM |
451 | /** |
452 | * @param string $fname | |
453 | * @param string $lname | |
454 | * @param null $email | |
455 | * @param null $contactSubtype | |
456 | * | |
457 | * @return array | |
458 | */ | |
542e6ea1 | 459 | function webtestAddContactWithGenderPrefixSuffix($fname = 'Anthony', $lname = 'Anderson', $email = NULL, $contactSubtype = NULL) { |
e0bbb596 AS |
460 | $url = $this->sboxPath . 'civicrm/contact/add?reset=1&ct=Individual'; |
461 | if ($contactSubtype) { | |
462 | $url = $url . "&cst={$contactSubtype}"; | |
463 | } | |
464 | $this->open($url); | |
465 | $this->waitForElementPresent('_qf_Contact_upload_view-bottom'); | |
466 | ||
467 | $this->type('first_name', $fname); | |
468 | $this->type('last_name', $lname); | |
469 | if ($email === TRUE) { | |
470 | $email = substr(sha1(rand()), 0, 7) . '@example.org'; | |
471 | } | |
472 | if ($email) { | |
473 | $this->type('email_1_email', $email); | |
474 | } | |
475 | $genderLabelArray = array( | |
476 | 1 => 'Female', | |
477 | 2 => 'Male', | |
478 | 3 => 'Transgender' | |
479 | ); | |
542e6ea1 AS |
480 | $prefix = rand(1, 4); |
481 | $suffix = rand(1, 8); | |
482 | $gender = rand(1, 3); | |
e0bbb596 AS |
483 | $genderLabel = "civicrm_gender_".$genderLabelArray[$gender]."_$gender"; |
484 | $this->select("prefix_id", "value=$prefix"); | |
485 | $this->select("suffix_id", "value=$suffix"); | |
486 | $this->click("demographics"); | |
487 | $this->waitForElementPresent("civicrm_gender_Female_1"); | |
488 | $this->click($genderLabel,"value=$gender"); | |
489 | $this->waitForElementPresent('_qf_Contact_upload_view-bottom'); | |
490 | $this->click('_qf_Contact_upload_view-bottom'); | |
491 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
542e6ea1 AS |
492 | $prefixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_prefix',$prefix); |
493 | $suffixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_suffix',$suffix); | |
494 | $genderLabel = WebTest_Export_ContactTest::getOptionLabel('gender',$gender); | |
495 | return array($email,$prefixLabel,$suffixLabel,$genderLabel); | |
496 | } | |
497 | ||
4cbe18b8 EM |
498 | /** |
499 | * @param $optionGroupName | |
500 | * @param $optionValue | |
501 | * | |
502 | * @return array|int | |
503 | */ | |
542e6ea1 AS |
504 | function getOptionLabel($optionGroupName,$optionValue){ |
505 | $params = array( | |
506 | 'version' => 3, | |
507 | 'sequential' => 1, | |
508 | 'option_group_name' => $optionGroupName, | |
509 | 'value' => $optionValue, | |
510 | 'return' => 'label' | |
511 | ); | |
512 | $optionLabel = $this->webtest_civicrm_api("OptionValue", "getvalue",$params); | |
513 | return $optionLabel; | |
e0bbb596 | 514 | } |
42daf119 | 515 | } |