From ba0ee914f90255a94a278bf6d1c66e8a7f875295 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Sat, 30 Jan 2016 13:40:17 +1100 Subject: [PATCH] Change autocomplete to lookup surname or firstname --- booking.test_rooms.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/booking.test_rooms.inc b/booking.test_rooms.inc index baa8d14..3d0f18b 100644 --- a/booking.test_rooms.inc +++ b/booking.test_rooms.inc @@ -11,7 +11,8 @@ function _booking_rooms_name_autocomplete($string) { $query = db_select('booking_person', 'p') ->fields('p', array('nid', 'booking_firstname', 'booking_lastname')); - $db_and = db_and()->condition('p.booking_lastname', '%' . db_like($string) . '%', 'LIKE')->condition('p.booking_event_id', $event->eid, '='); + $db_or = db_or()->condition('p.booking_lastname', '%' . db_like($string) . '%', 'LIKE')->condition('p.booking_firstname', '%' . db_like($string) . '%', 'LIKE'); + $db_and = db_and()->condition($db_or)->condition('p.booking_event_id', $event->eid, '='); $result = $query->condition($db_and) ->execute(); @@ -36,7 +37,7 @@ function booking_rooms_allocate_test_form($node, &$form_state, $location_id) { $options = array(); $counter = 0; - $prefix = "

Enter a person's surname in the text field to autocomplete with the person's details. Make sure you click on the person from the dropdown list that appears.

"; + $prefix = "

Enter part of a person's name in the text field and wait for the blue spinning circle to autocomplete with the person's details. Make sure you click on the person from the dropdown list that appears.

"; $form['first_para'] = array ( '#type' => 'markup', '#markup' => $prefix,