change autocomplete to include node ids
This commit is contained in:
@@ -189,7 +189,10 @@ function _booking_studygroups_name_autocomplete($string) {
|
||||
|
||||
$query = db_select('booking_person', 'p')
|
||||
->fields('p', array('nid', 'booking_firstname', 'booking_lastname'));
|
||||
$db_or = db_or()->condition('p.booking_lastname', '%' . db_like($string) . '%', 'LIKE')->condition('p.booking_firstname', '%' . db_like($string) . '%', 'LIKE');
|
||||
$db_or = db_or()
|
||||
->condition('p.booking_lastname', '%' . db_like($string) . '%', 'LIKE')
|
||||
->condition('p.booking_firstname', '%' . db_like($string) . '%', 'LIKE')
|
||||
->condition('p.nid', $string, "=");
|
||||
$db_and = db_and()->condition($db_or)->condition('p.booking_eventid', $event->eid, '=');
|
||||
$result = $query->condition($db_and)
|
||||
->execute();
|
||||
@@ -362,7 +365,6 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
$values = $form_state['input'];
|
||||
$group_id = $form_state['values']['booking_gid'];
|
||||
$update_messages = array();
|
||||
$message = "";
|
||||
$counter = 0;
|
||||
watchdog('booking_debug', "<pre>Studygroup leader/helper test submission form :\n@info</pre>", array('@info' => print_r( $form_state, true)));
|
||||
|
||||
@@ -375,7 +377,6 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
foreach ($role_types as $type => $type_id) {
|
||||
//iterate over the sessions for that role type
|
||||
foreach ($values[$type] as $session_id => $person) {
|
||||
$message = "";
|
||||
//get the previous value
|
||||
$previous_value = _booking_studygroup_leadhelp_edit_get_previous_value($form, $type, $type . '[' . $session_id . ']');
|
||||
//watchdog('booking_debug', "<pre>Studygroup assignment previous value:\n@info\nCurrent value:\n@current</pre>",
|
||||
@@ -383,7 +384,7 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
//compare it against $person
|
||||
//if $person is now empty, set the person's role to zero
|
||||
if (empty($person) && $previous_value != 0) {
|
||||
$message = t("Clearing leader/helper role for nid @id and group @group. Used to have role @role.",
|
||||
$update_messages[] = t("Clearing leader/helper role for nid @id and group @group. Used to have role @role.",
|
||||
array('@id' => $previous_value, '@group' => $group_id, '@role' => $type_id));
|
||||
db_update('booking_studygroup_mapping')
|
||||
->fields(array(
|
||||
@@ -399,7 +400,7 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
$person_nid = $matches[1];
|
||||
//if $person is now different, run an update query
|
||||
if ($person_nid != $previous_value) {
|
||||
$message = t("Adding role @role to nid @id in group @group and session @session.",
|
||||
$update_messages[] = t("Adding role @role to nid @id in group @group and session @session.",
|
||||
array('@id' => $previous_value, '@group' => $group_id, '@role' => $type_id, '@session' => $session_id));
|
||||
//add the role to the new person
|
||||
db_update('booking_studygroup_mapping')
|
||||
@@ -408,11 +409,11 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
'booking_session_id' => $session_id,
|
||||
))
|
||||
->condition('booking_studygroup_id', $group_id)
|
||||
->condition('booking_node_id', $previous_value)
|
||||
->condition('booking_node_id', $person_nid)
|
||||
//->condition('booking_session_id', $session_id)
|
||||
->execute();
|
||||
//remove the role from the old person
|
||||
$message = t("Removing role @role from nid @id in group @group and session @session.",
|
||||
$update_messages[] = t("Removing role @role from nid @id in group @group and session @session.",
|
||||
array('@id' => $previous_value, '@group' => $group_id, '@role' => $type_id, '@session' => $session_id));
|
||||
db_update('booking_studygroup_mapping')
|
||||
->fields(array(
|
||||
@@ -424,7 +425,6 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
$update_messages[] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user