Change autocomplete to lookup surname or firstname
This commit is contained in:
@@ -11,7 +11,8 @@ function _booking_rooms_name_autocomplete($string) {
|
|||||||
|
|
||||||
$query = db_select('booking_person', 'p')
|
$query = db_select('booking_person', 'p')
|
||||||
->fields('p', array('nid', 'booking_firstname', 'booking_lastname'));
|
->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)
|
$result = $query->condition($db_and)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ function booking_rooms_allocate_test_form($node, &$form_state, $location_id) {
|
|||||||
$options = array();
|
$options = array();
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
|
|
||||||
$prefix = "<p>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.</p>";
|
$prefix = "<p>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.</p>";
|
||||||
$form['first_para'] = array (
|
$form['first_para'] = array (
|
||||||
'#type' => 'markup',
|
'#type' => 'markup',
|
||||||
'#markup' => $prefix,
|
'#markup' => $prefix,
|
||||||
|
Reference in New Issue
Block a user