logic fix

This commit is contained in:
2016-06-04 12:57:47 +10:00
parent 8cce7121a3
commit 372c4d4f80

View File

@@ -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) {