From: Thomas Schüttler Date: Thu, 11 Jan 2018 12:56:59 +0000 (+0100) Subject: CRM-21651 - Activity_Email/SMS_Add - Fix loading failed when no contact is found X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=aa8ff3474d99b06498c40c453b07f058083d6c34;p=civicrm-core.git CRM-21651 - Activity_Email/SMS_Add - Fix loading failed when no contact is found --- diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index cfdff39d0f..6f9123fac6 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -388,6 +388,7 @@ class CRM_Contact_Page_AJAX { } if ($queryString) { + $result = array(); $offset = CRM_Utils_Array::value('offset', $_GET, 0); $rowCount = Civi::settings()->get('search_autocomplete_count'); @@ -450,9 +451,7 @@ LIMIT {$offset}, {$rowCount} ); } } - if ($result) { - CRM_Utils_JSON::output($result); - } + CRM_Utils_JSON::output($result); } } CRM_Utils_System::civiExit(); @@ -483,6 +482,7 @@ LIMIT {$offset}, {$rowCount} } if ($queryString) { + $result = array(); $offset = CRM_Utils_Array::value('offset', $_GET, 0); $rowCount = CRM_Utils_Array::value('rowcount', $_GET, 20); @@ -519,9 +519,6 @@ LIMIT {$offset}, {$rowCount} 'id' => (CRM_Utils_Array::value('id', $_GET)) ? "{$dao->id}::{$dao->phone}" : '"' . $dao->name . '" <' . $dao->phone . '>', ); } - } - - if ($result) { CRM_Utils_JSON::output($result); } CRM_Utils_System::civiExit();