fix case where changing leader from one group to another removed them completely
This commit is contained in:
@@ -384,14 +384,15 @@ 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) {
|
||||
$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));
|
||||
$update_messages[] = t("Clearing leader/helper role for nid @id and session @session in group @group. Used to have role @role.",
|
||||
array('@id' => $previous_value, '@group' => $group_id, '@role' => $type_id, '@session' => $session_id));
|
||||
db_update('booking_studygroup_mapping')
|
||||
->fields(array(
|
||||
'booking_studygroup_role' => 0,
|
||||
))
|
||||
->condition('booking_studygroup_id', $group_id)
|
||||
->condition('booking_node_id', $previous_value)
|
||||
->condition('booking_session_id', $session_id)
|
||||
->execute();
|
||||
$counter++;
|
||||
}
|
||||
@@ -410,7 +411,6 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
|
||||
))
|
||||
->condition('booking_studygroup_id', $group_id)
|
||||
->condition('booking_node_id', $person_nid)
|
||||
//->condition('booking_session_id', $session_id)
|
||||
->execute();
|
||||
$counter++;
|
||||
//remove the role from the old person if there was someone else there before
|
||||
|
Reference in New Issue
Block a user