From 0997686c31d548e91aa57d7d599979b687d55cf5 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Wed, 16 Oct 2013 15:43:59 -0700 Subject: [PATCH] CRM-11245 - Reworked the patch to use the configured date format. ---------------------------------------- * CRM-11245: Display more information in the "Event Name" autocomplete when searching http://issues.civicrm.org/jira/browse/CRM-11245 --- CRM/Event/Page/AJAX.php | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/CRM/Event/Page/AJAX.php b/CRM/Event/Page/AJAX.php index 86fde41e77..6e9e1fee80 100644 --- a/CRM/Event/Page/AJAX.php +++ b/CRM/Event/Page/AJAX.php @@ -52,14 +52,33 @@ class CRM_Event_Page_AJAX { $whereClause .= " AND ( end_date IS NULL OR end_date >= NOW() )"; } $query = " -SELECT title, id -FROM civicrm_event -WHERE {$whereClause} -ORDER BY title + SELECT civicrm_event.title AS title, + civicrm_event.id AS id, + civicrm_address.city AS city, + civicrm_event.start_date + FROM civicrm_event + LEFT JOIN civicrm_loc_block ON + civicrm_event.loc_block_id = civicrm_loc_block.id + LEFT JOIN civicrm_address ON + civicrm_loc_block.address_id = civicrm_address.id + WHERE + {$whereClause} + ORDER BY + civicrm_event.title "; $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { - echo $elements = "$dao->title|$dao->id\n"; + $fields = array(); + foreach (array('title', 'city') as $field) { + if (isset($dao->$field)) { + array_push($fields, $dao->$field); + } + } + if (isset($dao->start_date)) { + array_push($fields, CRM_Utils_Date::customFormat($dao->start_date)); + } + $eventinfo = implode(' - ', $fields); + echo $elements = "$eventinfo|$dao->id\n"; } CRM_Utils_System::civiExit(); } -- 2.25.1