CRM-15442 - Change spaces to wildcards in contact.getlist api
authorColeman Watts <coleman@civicrm.org>
Wed, 15 Oct 2014 02:33:28 +0000 (22:33 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 15 Oct 2014 02:33:28 +0000 (22:33 -0400)
api/v3/Contact.php

index de3602f10af6beb8d690953cd0497fb2d3b758a4..d0c7cfabab295ea58aa82112302fef4a80dcdc85 100644 (file)
@@ -982,7 +982,8 @@ function _civicrm_api3_contact_getlist_params(&$request) {
   $request['params']['options']['sort'] = 'sort_name';
   // Contact api doesn't support array(LIKE => 'foo') syntax
   if (!empty($request['input'])) {
-    $request['params'][$request['search_field']] = $request['input'];
+    // CRM-15442 - change spaces to % wildcards when searching by name
+    $request['params'][$request['search_field']] = strpos($request['search_field'], 'name') ? str_replace(' ', '%', $request['input']) : $request['input'];
   }
 }