CRM-12326 ensure is_deleted is applied to email search part
authoreileenmcnaugton <eileen@fuzion.co.nz>
Sat, 22 Aug 2015 09:14:32 +0000 (21:14 +1200)
committereileenmcnaugton <eileen@fuzion.co.nz>
Sat, 22 Aug 2015 09:14:32 +0000 (21:14 +1200)
api/v3/Contact.php
tests/phpunit/api/v3/ContactTest.php

index 9e9f754cd9afb160dfaf24823b40175f66dcc4e2..5f603974ef4038ad07fa4f52249c990e193f3bd1 100644 (file)
@@ -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}
       )
index a892a89561b9a420bfcef11414606e93323c185e..1d3937d37be4a46b040aed40b24e5cbcf3977927 100644 (file)
@@ -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']);
   }
 
   /**