From 7f6f3df1b3a71a07b29f117249db0acf9a51768c Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Sat, 22 Aug 2015 21:14:32 +1200 Subject: [PATCH] CRM-12326 ensure is_deleted is applied to email search part --- api/v3/Contact.php | 2 +- tests/phpunit/api/v3/ContactTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 9e9f754cd9..5f603974ef 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -906,7 +906,7 @@ function civicrm_api3_contact_getquick($params) { FROM civicrm_contact cc {$from} {$aclFrom} {$additionalFrom} {$includeEmailFrom} - {$emailWhere} + {$emailWhere} AND cc.is_deleted = 0 {$orderByInner} LIMIT 0, {$limit} ) diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index a892a89561..1d3937d37b 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -2186,6 +2186,21 @@ class api_v3_ContactTest extends CiviUnitTestCase { foreach ($expectedData as $index => $value) { $this->assertEquals($value, $result['values'][$index]['data']); } + $result = $this->callAPISuccess('contact', 'getquick', array( + 'name' => 'h.', + )); + $expectedData = array( + 'H Bobby, Bobby :: bob@h.com', + ); + foreach ($expectedData as $index => $value) { + $this->assertEquals($value, $result['values'][$index]['data']); + } + $this->callAPISuccess('Setting', 'create', array('includeWildCardInName' => FALSE)); + $result = $this->callAPISuccess('contact', 'getquick', array( + 'name' => 'h.', + )); + $this->callAPISuccess('Setting', 'create', array('includeWildCardInName' => TRUE)); + $this->assertEquals(0, $result['count']); } /** -- 2.25.1