diff --git a/booking.travel.inc b/booking.travel.inc index 866519f..f56be4e 100644 --- a/booking.travel.inc +++ b/booking.travel.inc @@ -294,7 +294,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tok //calculate which fields to show and whether we need to show the fieldset at all $show_dietary = variable_get('booking_enable_dietary', 0) == 1 || $inserting == FALSE; $show_medical = variable_get('booking_enable_medcond', 0) == 1 || $inserting == FALSE; - $show_roommate = variable_get('booking_enable_roommate', 0) == 1 || $inserting == FALSE; + $show_roommate = (variable_get('booking_enable_roommate', 0) == 1 && $person->booking_partner_id == 0) || $inserting == FALSE; $show_bf_gf = $person->booking_partner_id == 0 || $inserting == FALSE; $show_special_requirements = ($show_dietary || $show_medical || $show_roommate || $show_bf_gf); @@ -324,19 +324,16 @@ function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tok '#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : $booking_medical_conditions ); } - //only show the room mate field if we're allowed to + //only show the room mate field if we're allowed to and the person isn't married if ($show_roommate) { - //married people won't need to select a room mate - if ($person->booking_partner_id == 0) { - $form['requirements']['booking_room_mate1'] = array( - '#type' => 'textfield', - '#title' => t('I would like to share a room with'), - '#description' => t('This field contains information you entered when you registered. Update if necessary.'), - '#maxlength' => 200, - '#required' => FALSE, - '#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : $booking_roommate - ); - } + $form['requirements']['booking_room_mate1'] = array( + '#type' => 'textfield', + '#title' => t('I would like to share a room with'), + '#description' => t('This field contains information you entered when you registered. Update if necessary.'), + '#maxlength' => 200, + '#required' => FALSE, + '#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : $booking_roommate + ); } //only show this field if this person isn't married if ($show_bf_gf) {