more fixing
This commit is contained in:
@@ -119,23 +119,36 @@ function travel_form($node, &$form_state, $db_node = NULL, $inserting = FALSE, $
|
|||||||
watchdog('booking_debug', "<pre>Travel form empty node:\n@info</pre>", array('@info' => print_r( $data, true)));
|
watchdog('booking_debug', "<pre>Travel form empty node:\n@info</pre>", array('@info' => print_r( $data, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//get info about this person from the relevant node id
|
//get info from the database if we don't have it
|
||||||
$person = db_query("SELECT booking_dietary, booking_medical_conditions, booking_bf_gf_nid, booking_partner_id, booking_room_mate1 " .
|
if (! $data->booking_dietary) {
|
||||||
"FROM {booking_person} " . "WHERE nid = :nid ",
|
watchdog('booking_debug', "<pre>Travel form querying database for missing details</pre>");
|
||||||
array(':nid' => isset($data->nid) ? $data->nid : $data->booking_person_nid))->fetchObject();
|
|
||||||
|
$person = db_query("SELECT booking_dietary, booking_medical_conditions, booking_bf_gf_nid, booking_partner_id, booking_room_mate1 " .
|
||||||
if ($person) {
|
"FROM {booking_person} " . "WHERE nid = :nid ",
|
||||||
//watchdog('booking_debug', "<pre>Person info from database:\n@info</pre>", array('@info' => print_r( $person, true)));
|
array(':nid' => isset($data->nid) ? $data->nid : $data->booking_person_nid))->fetchObject();
|
||||||
$booking_dietary = $person->booking_dietary;
|
|
||||||
$booking_medical_conditions = $person->booking_medical_conditions;
|
//check we got results
|
||||||
//an empty value is zero in this case
|
if ($person) {
|
||||||
$booking_bf_gf_nid = $person->booking_bf_gf_nid == 0 ? '' : $person->booking_bf_gf_nid;
|
//watchdog('booking_debug', "<pre>Person info from database:\n@info</pre>", array('@info' => print_r( $person, true)));
|
||||||
$booking_roommate = $person->booking_room_mate1;
|
$booking_dietary = $person->booking_dietary;
|
||||||
}
|
$booking_medical_conditions = $person->booking_medical_conditions;
|
||||||
else {
|
//an empty value is zero in this case
|
||||||
watchdog('booking_debug', "<pre>Failed to retrieve person from database using nid from data variable:\n@info</pre>", array('@info' => print_r( $data, true)));
|
$booking_bf_gf_nid = $person->booking_bf_gf_nid == 0 ? '' : $person->booking_bf_gf_nid;
|
||||||
|
$booking_roommate = $person->booking_room_mate1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
watchdog('booking_debug', "<pre>Failed to retrieve person from database using nid from data variable:\n@info</pre>", array('@info' => print_r( $data, true)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
watchdog('booking_debug', "<pre>Travel form not querying database for missing details</pre>");
|
||||||
|
$booking_dietary = $data->booking_dietary;
|
||||||
|
$booking_medical_conditions = $data->booking_medical_conditions;
|
||||||
|
//an empty value is zero in this case
|
||||||
|
$booking_bf_gf_nid = $data->booking_bf_gf_nid == 0 ? '' : $data->booking_bf_gf_nid;
|
||||||
|
$booking_roommate = $data->booking_room_mate1;
|
||||||
|
}
|
||||||
|
|
||||||
//form starts here
|
//form starts here
|
||||||
//store the node id
|
//store the node id
|
||||||
$form['personid'] = array(
|
$form['personid'] = array(
|
||||||
@@ -293,8 +306,8 @@ function travel_form($node, &$form_state, $db_node = NULL, $inserting = FALSE, $
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//calculate which fields to show and whether we need to show the fieldset at all
|
//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_dietary = ((variable_get('booking_enable_dietary', 0) == 1) || ($inserting == FALSE));
|
||||||
$show_medical = variable_get('booking_enable_medcond', 0) == 1 || $inserting == FALSE;
|
$show_medical = ((variable_get('booking_enable_medcond', 0) == 1) || ($inserting == FALSE));
|
||||||
$show_roommate = (variable_get('booking_enable_roommate', 0) == 1 && $person->booking_partner_id == 0) || $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_bf_gf = $person->booking_partner_id == 0 || $inserting == FALSE;
|
||||||
$show_special_requirements = ($show_dietary || $show_medical || $show_roommate || $show_bf_gf);
|
$show_special_requirements = ($show_dietary || $show_medical || $show_roommate || $show_bf_gf);
|
||||||
|
Reference in New Issue
Block a user